diff --git a/backend/agent/servers/mcp_server_code_execution.py b/backend/agent/servers/mcp_server_code_execution.py index e2d69d2..c2608e5 100644 --- a/backend/agent/servers/mcp_server_code_execution.py +++ b/backend/agent/servers/mcp_server_code_execution.py @@ -1,5 +1,7 @@ import ast import subprocess +import sys + import io from pyflakes.api import check # For linting Code from pyflakes.reporter import Reporter # For linting Code @@ -233,7 +235,8 @@ def run_python_sandboxed(code: str) -> str: try: result = subprocess.run( - ["python", "-c", code], + [sys.executable, "-c", code], + stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=EXEC_TIMEOUT)