From 6a4a501acbf8e2ac7614c3608033333c50dc78ce Mon Sep 17 00:00:00 2001 From: ludoplex Date: Mon, 23 Mar 2026 04:06:56 -0600 Subject: [PATCH] fix: add windowsHide and explicit stdio pipes to prevent pwsh.exe stdout loss When defaultShell is pwsh.exe (PowerShell 7), child processes spawned by start_process fail to capture stdout because .NET 8 runtime allocates a new console via AllocConsole() instead of inheriting Node.js stdio pipes. Add windowsHide: true to suppress new console allocation and explicitly set stdio to [pipe, pipe, pipe] so child output routes back through Node.js regardless of the shell runtime. Fixes #378 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/terminal-manager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/terminal-manager.ts b/src/terminal-manager.ts index 0c902c43..816e4605 100644 --- a/src/terminal-manager.ts +++ b/src/terminal-manager.ts @@ -157,12 +157,14 @@ export class TerminalManager { // Use shell-specific configuration with login flags where appropriate spawnConfig = getShellSpawnArgs(shellToUse, enhancedCommand); spawnOptions = { + stdio: ['pipe', 'pipe', 'pipe'] as const, + windowsHide: true, // Prevent .NET-based shells (pwsh.exe) from allocating a new console env: { ...process.env, TERM: 'xterm-256color' // Better terminal compatibility } }; - + // Add shell option if needed (for unknown shells) if (spawnConfig.useShellOption) { spawnOptions.shell = spawnConfig.useShellOption; @@ -176,6 +178,8 @@ export class TerminalManager { }; spawnOptions = { shell: shellToUse, + stdio: ['pipe', 'pipe', 'pipe'] as const, + windowsHide: true, env: { ...process.env, TERM: 'xterm-256color'