Skip to content

Commit 6171fef

Browse files
committed
🤖 fix: disable detached mode on Windows for PowerShell wrapper
On Windows, detached:true creates a separate console window which interferes with output capture when combined with PowerShell's -WindowStyle Hidden. The detached option is primarily needed on Unix for process group management. On Windows with the PowerShell wrapper, we don't need it and it actively breaks stdout/stderr capture.
1 parent fc250b6 commit 6171fef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/node/runtime/LocalBaseRuntime.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ export abstract class LocalBaseRuntime implements Runtime {
9393
? ["-n", options.niceness.toString(), bashCommand, ...bashArgs]
9494
: bashArgs;
9595

96+
// On Windows with PowerShell wrapper, detached:true creates a separate console
97+
// which interferes with output capture. Only use detached on non-Windows.
98+
// On Windows, PowerShell's -WindowStyle Hidden handles console hiding.
99+
const useDetached = !isWindows;
100+
96101
const childProcess = spawn(spawnCommand, spawnArgs, {
97102
cwd: spawnCwd,
98103
env: {
@@ -106,7 +111,8 @@ export abstract class LocalBaseRuntime implements Runtime {
106111
// the entire process group (including all backgrounded children) via process.kill(-pid).
107112
// NOTE: detached:true does NOT cause bash to wait for background jobs when using 'exit' event
108113
// instead of 'close' event. The 'exit' event fires when bash exits, ignoring background children.
109-
detached: true,
114+
// WINDOWS NOTE: detached:true causes issues with PowerShell wrapper output capture.
115+
detached: useDetached,
110116
// Prevent console window from appearing on Windows (WSL bash spawns steal focus otherwise)
111117
windowsHide: true,
112118
});

0 commit comments

Comments
 (0)