diff --git a/packages/core/src/services/shellExecutionService.ts b/packages/core/src/services/shellExecutionService.ts index 46b894426f..363a2cca92 100644 --- a/packages/core/src/services/shellExecutionService.ts +++ b/packages/core/src/services/shellExecutionService.ts @@ -529,12 +529,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, });