From c47233a4743f1ba9bd46c3c1a664ad57813a6f11 Mon Sep 17 00:00:00 2001 From: euxaristia <25621994+euxaristia@users.noreply.github.com> Date: Tue, 21 Apr 2026 16:01:28 -0400 Subject: [PATCH] fix(core): disable detached mode in Bun to prevent immediate SIGHUP of child processes (#22620) --- packages/core/src/services/shellExecutionService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/services/shellExecutionService.ts b/packages/core/src/services/shellExecutionService.ts index 4fbee62e2f..93c55f0636 100644 --- a/packages/core/src/services/shellExecutionService.ts +++ b/packages/core/src/services/shellExecutionService.ts @@ -531,12 +531,18 @@ export class ShellExecutionService { cwd: finalCwd, } = prepared; + // Bun's child_process does not properly call setsid() for detached + // processes, leaving children in the parent's session without a + // controlling terminal. They receive SIGHUP immediately. Disable + // detached mode in Bun; killProcessGroup already falls back to + // direct-pid kill when the group kill fails. + const isBun = 'bun' in process.versions; const child = cpSpawn(finalExecutable, finalArgs, { cwd: finalCwd, stdio: ['ignore', 'pipe', 'pipe'], windowsVerbatimArguments: isWindows ? false : undefined, shell: false, - detached: !isWindows, + detached: !isWindows && !isBun, env: finalEnv, });