mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -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,6 +678,14 @@ export class ShellExecutionService {
|
||||
return { pid: ptyProcess.pid, result };
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
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,
|
||||
result: Promise.resolve({
|
||||
@@ -693,6 +701,7 @@ export class ShellExecutionService {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a string to the pseudo-terminal (PTY) of a running process.
|
||||
|
||||
Reference in New Issue
Block a user