From d56c32bc9d757916ecc3d69b3039abd768b78f92 Mon Sep 17 00:00:00 2001 From: Astral Products <157904385+ilyaxuwu@users.noreply.github.com> Date: Thu, 9 Jul 2026 21:35:36 +0300 Subject: [PATCH] Update run-terminal-command.ts --- sdk/src/tools/run-terminal-command.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sdk/src/tools/run-terminal-command.ts b/sdk/src/tools/run-terminal-command.ts index af3122bddb..d1d419ee5a 100644 --- a/sdk/src/tools/run-terminal-command.ts +++ b/sdk/src/tools/run-terminal-command.ts @@ -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, })