Improve pty resize error handling for Windows (#13353)

This commit is contained in:
Gal Zahavi
2025-11-18 18:08:01 -08:00
committed by GitHub
parent 90c764ce13
commit c5498bbb07
@@ -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.