mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 13:22:35 -07:00
Improve pty resize error handling for Windows (#13353)
This commit is contained in:
@@ -768,11 +768,13 @@ export class ShellExecutionService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore errors if the pty has already exited, which can happen
|
// Ignore errors if the pty has already exited, which can happen
|
||||||
// due to a race condition between the exit event and this call.
|
// due to a race condition between the exit event and this call.
|
||||||
if (
|
const err = e as { code?: string; message?: string };
|
||||||
e instanceof Error &&
|
const isEsrch = err.code === 'ESRCH';
|
||||||
(('code' in e && e.code === 'ESRCH') ||
|
const isWindowsPtyError = err.message?.includes(
|
||||||
e.message.includes('Cannot resize a pty that has already exited'))
|
'Cannot resize a pty that has already exited',
|
||||||
) {
|
);
|
||||||
|
|
||||||
|
if (isEsrch || isWindowsPtyError) {
|
||||||
// On Unix, we get an ESRCH error.
|
// On Unix, we get an ESRCH error.
|
||||||
// On Windows, we get a message-based error.
|
// On Windows, we get a message-based error.
|
||||||
// In both cases, it's safe to ignore.
|
// In both cases, it's safe to ignore.
|
||||||
|
|||||||
Reference in New Issue
Block a user