Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions sdk/src/tools/run-terminal-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,16 @@ export function runTerminalCommand({
cwd: resolvedCwd,
env: processEnv,
stdio: 'pipe',
// On POSIX, give the command its own process group so that killing it
// (timeout or user abort) also kills any grandchild processes.
detached: !isWindows,
// On Windows, give the child its own invisible console (CREATE_NO_WINDOW)
// instead of attaching it to the TUI's console. Console-attached
// descendants can open CONIN$/CONOUT$ directly (cmd, pause, choice,
// PSReadLine, ...) even when stdio is piped, stealing the VT input that
// ConPTY generates for the TUI's mouse/focus tracking and echoing it as
// gibberish like `^[[I^[[<35;12;7M` painted over the UI.
// Give the command its own process group so that killing it (timeout or
// user abort) also kills any grandchild processes. On POSIX this uses a
// negative pid kill against the process group. On Windows `detached: true`
// maps to DETACHED_PROCESS, which combined with CREATE_NO_WINDOW (from
// windowsHide) completely detaches the child from the parent's console.
// Without DETACHED_PROCESS, console-attached descendants can open
// CONIN$/CONOUT$ directly even when stdio is piped, stealing the VT input
// that ConPTY generates for the TUI's mouse/focus tracking and echoing it
// as gibberish like `^[[I^[[<35;12;7M` painted over the UI.
detached: true,
windowsHide: true,
})

Expand Down