mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(core): Handle PTY spawn errors in macOS sandbox (#11539)
This commit is contained in:
@@ -22,4 +22,6 @@
|
||||
(literal "/dev/stdout")
|
||||
(literal "/dev/stderr")
|
||||
(literal "/dev/null")
|
||||
)
|
||||
(literal "/dev/ptmx")
|
||||
(regex #"^/dev/ttys[0-9]*$")
|
||||
)
|
||||
|
||||
@@ -678,19 +678,28 @@ export class ShellExecutionService {
|
||||
return { pid: ptyProcess.pid, result };
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
return {
|
||||
pid: undefined,
|
||||
result: Promise.resolve({
|
||||
error,
|
||||
rawOutput: Buffer.from(''),
|
||||
output: '',
|
||||
exitCode: 1,
|
||||
signal: null,
|
||||
aborted: false,
|
||||
if (error.message.includes('posix_spawnp failed')) {
|
||||
onOutputEvent({
|
||||
type: 'data',
|
||||
chunk:
|
||||
'[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to sandbox restrictions.\n',
|
||||
});
|
||||
throw e;
|
||||
} else {
|
||||
return {
|
||||
pid: undefined,
|
||||
executionMethod: 'none',
|
||||
}),
|
||||
};
|
||||
result: Promise.resolve({
|
||||
error,
|
||||
rawOutput: Buffer.from(''),
|
||||
output: '',
|
||||
exitCode: 1,
|
||||
signal: null,
|
||||
aborted: false,
|
||||
pid: undefined,
|
||||
executionMethod: 'none',
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user