From 816c6dac614e3c33e20c5b91bd3d13483e0d9881 Mon Sep 17 00:00:00 2001 From: Praveens-Pepper-AI Date: Mon, 28 Sep 2026 22:33:35 -0400 Subject: [PATCH] fix(dev): exit non-zero when Electron is killed by a signal (#918) `ChildProcess`'s `close` event fires as `(code, signal)` and `code` is null when the child was terminated by a signal. `process.exit` ignores its second argument and coerces null to 0, so passing the listener directly reports every signal death as a successful exit. Handle the two arguments explicitly so a signal death exits non-zero. --- src/electron.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/electron.ts b/src/electron.ts index 91d01ac..43d0482 100644 --- a/src/electron.ts +++ b/src/electron.ts @@ -165,7 +165,10 @@ export function startElectron(root: string | undefined): ChildProcess { const entry = process.env.ELECTRON_ENTRY || '.' const ps = spawn(electronPath, [entry].concat(args), { stdio: 'inherit' }) - ps.on('close', process.exit) + // `code` is null when the child was terminated by a signal, and `process.exit` ignores + // its second argument, so passing the listener directly would report every crash as a + // successful exit. Map a signal death to a non-zero status instead. + ps.on('close', (code, signal) => process.exit(code ?? (signal ? 1 : 0))) return ps }