mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
fix(core): disable detached mode in Bun to prevent immediate SIGHUP of child processes (#22620)
This commit is contained in:
@@ -531,12 +531,18 @@ export class ShellExecutionService {
|
|||||||
cwd: finalCwd,
|
cwd: finalCwd,
|
||||||
} = prepared;
|
} = 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, {
|
const child = cpSpawn(finalExecutable, finalArgs, {
|
||||||
cwd: finalCwd,
|
cwd: finalCwd,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
windowsVerbatimArguments: isWindows ? false : undefined,
|
windowsVerbatimArguments: isWindows ? false : undefined,
|
||||||
shell: false,
|
shell: false,
|
||||||
detached: !isWindows,
|
detached: !isWindows && !isBun,
|
||||||
env: finalEnv,
|
env: finalEnv,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user