Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(exec): detach stdin for shell commands
Xubin Ren3eebe08dba1f
diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.pyindex 3412a11a7..0252b9746 100644--- a/nanobot/agent/tools/shell.py+++ b/nanobot/agent/tools/shell.py@@ -266,6 +266,7 @@ class ExecTool(Tool):# the raw command string to COMSPEC without re-quoting.return await asyncio.create_subprocess_shell(command,+ stdin=asyncio.subprocess.DEVNULL,stdout=asyncio.subprocess.PIPE,stderr=asyncio.subprocess.PIPE,cwd=cwd,@@ -274,6 +275,7 @@ class ExecTool(Tool):bash = shutil.which("bash") or "/bin/bash"return await asyncio.create_subprocess_exec(bash, "-l", "-c", command,+ stdin=asyncio.subprocess.DEVNULL,stdout=asyncio.subprocess.PIPE,stderr=asyncio.subprocess.PIPE,cwd=cwd,diff --git a/tests/tools/test_exec_platform.py b/tests/tools/test_exec_platform.pyindex 301df4a7a..69a271ec1 100644--- a/tests/tools/test_exec_platform.py+++ b/tests/tools/test_exec_platform.py@@ -5,6 +5,7 @@ strategy, and sandbox behaviour per platform — without actually runningplatform-specific binaries (all subprocess calls are mocked)."""+import asyncioimport sysfrom unittest.mock import AsyncMock, patch@@ -108,6 +109,9 @@ class TestSpawnUnix:assert "-c" in argsassert "echo hi" in args+ kwargs = mock_exec.call_args[1]+ assert kwargs["stdin"] == asyncio.subprocess.DEVNULL+class TestSpawnWindows:@@ -124,6 +128,9 @@ class TestSpawnWindows:args = mock_shell.call_args[0]assert "dir" in args+ kwargs = mock_shell.call_args[1]+ assert kwargs["stdin"] == asyncio.subprocess.DEVNULL+@pytest.mark.asyncioasync def test_passes_cwd_and_env(self):env = {"PATH": "/usr/bin"}