fix(coding-agent): remove detached: true on Windows to fix pwsh.exe stdio (#4013)

On Windows, spawn(..., { detached: true }) prevents pwsh.exe (PowerShell) from
producing any stdout/stderr through pipe streams. This is because detached creates
a new process group which breaks pwsh's console host communication.

bash.exe and other cygwin/msys2 shells are unaffected by detached: true, but
they don't need it either -- on Windows, killProcessTree() already uses
taskkill /F /T /PID which kills the process tree by PID regardless of
whether the process was spawned detached.

The detached flag only matters on Unix, where kill(-pid, SIGKILL) requires a
process group that is only created via detached: true.

Fixes #4012
This commit is contained in:
pica
2026-05-01 02:59:02 +08:00
committed by GitHub
parent 7dc1bed478
commit 24dec9fcd5

View File

@@ -83,7 +83,7 @@ export function createLocalBashOperations(options?: { shellPath?: string }): Bas
}
const child = spawn(shell, [...args, command], {
cwd,
detached: true,
detached: process.platform !== "win32",
env: env ?? getShellEnv(),
stdio: ["ignore", "pipe", "pipe"],
});