mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-02 09:20:42 -07:00
Fix bug executing commands in windows whose flags contain spaces (#5317)
This commit is contained in:
committed by
GitHub
parent
6f7beb414c
commit
a3a432e3cf
@@ -89,13 +89,16 @@ export class ShellExecutionService {
|
||||
abortSignal: AbortSignal,
|
||||
): ShellExecutionHandle {
|
||||
const isWindows = os.platform() === 'win32';
|
||||
const shell = isWindows ? 'cmd.exe' : 'bash';
|
||||
const shellArgs = [isWindows ? '/c' : '-c', commandToExecute];
|
||||
|
||||
const child = spawn(shell, shellArgs, {
|
||||
const child = spawn(commandToExecute, [], {
|
||||
cwd,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
detached: !isWindows, // Use process groups on non-Windows for robust killing
|
||||
// Use bash unless in Windows (since it doesn't support bash).
|
||||
// For windows, just use the default.
|
||||
shell: isWindows ? true : 'bash',
|
||||
// Use process groups on non-Windows for robust killing.
|
||||
// Windows process termination is handled by `taskkill /t`.
|
||||
detached: !isWindows,
|
||||
env: {
|
||||
...process.env,
|
||||
GEMINI_CLI: '1',
|
||||
|
||||
Reference in New Issue
Block a user