From 28b8c32c8324c9def5db9f3c20b45fff67a90a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=A4der?= Date: Tue, 31 Dec 2024 17:17:17 +0100 Subject: [PATCH] Handle exit code undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit see https://github.com/microsoft/node-pty/issues/751 Signed-off-by: Thomas Mäder --- packages/process/src/node/terminal-process.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/process/src/node/terminal-process.ts b/packages/process/src/node/terminal-process.ts index f6879af71a08d..468f494d803f1 100644 --- a/packages/process/src/node/terminal-process.ts +++ b/packages/process/src/node/terminal-process.ts @@ -155,6 +155,10 @@ export class TerminalProcess extends Process { // node-pty actually wait for the underlying streams to be closed before emitting exit. // We should emulate the `exit` and `close` sequence. terminal.onExit(({ exitCode, signal }) => { + // see https://github.com/microsoft/node-pty/issues/751 + if (exitCode === undefined) { + exitCode = 0; + } // Make sure to only pass either code or signal as !undefined, not // both. //