fix(exec): detach stdin for shell commands

This commit is contained in:
Xubin Ren
2026-05-20 12:07:17 +08:00
parent 38a5f09f02
commit 3eebe08dba
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -5,6 +5,7 @@ strategy, and sandbox behaviour per platform — without actually running
platform-specific binaries (all subprocess calls are mocked).
"""
import asyncio
import sys
from unittest.mock import AsyncMock, patch
@@ -108,6 +109,9 @@ class TestSpawnUnix:
assert "-c" in args
assert "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.asyncio
async def test_passes_cwd_and_env(self):
env = {"PATH": "/usr/bin"}