fix(bash): use PowerShell on Windows to capture system utility output

Windows system utilities like ipconfig, systeminfo, etc. write directly to
the console via WriteConsole API instead of stdout. When Node.js spawns
cmd.exe with piped stdio, these utilities produce empty output.

Changes:
- Switch from cmd.exe to PowerShell on Windows (properly redirects output)
- Disable detached mode on Windows (PowerShell doesn't pipe stdout when detached)
- Add windowsHide option to prevent console window flashing
- Update tests to use PowerShell-compatible syntax (Start-Sleep, semicolons)
This commit is contained in:
myfunc
2026-01-11 16:35:21 -08:00
committed by Peter Steinberger
parent e3be5f8369
commit b33bd6aaeb
3 changed files with 19 additions and 9 deletions

View File

@@ -265,15 +265,17 @@ export function createBashTool(
{
cwd: workdir,
env: process.env,
detached: true,
detached: process.platform !== "win32",
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
},
)
: spawn(shell, [...shellArgs, params.command], {
cwd: workdir,
env,
detached: true,
detached: process.platform !== "win32",
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
});
const session = {