From 4a54bdffc857e67dad71e0f1873c1c9c24c48419 Mon Sep 17 00:00:00 2001 From: sylt Date: Tue, 21 Oct 2025 14:09:41 +0200 Subject: [PATCH] electronmon: Detect app exit due to signal This can occur if electron itself crashes. --- src/electronmon.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/electronmon.js b/src/electronmon.js index 3e25a34..fc1ed5b 100644 --- a/src/electronmon.js +++ b/src/electronmon.js @@ -90,7 +90,7 @@ module.exports = ({ app.on('message', onMessage); - app.once('exit', code => { + app.once('exit', (code, signal) => { process.removeListener('SIGTERM', onTerm); process.removeListener('SIGHUP', onTerm); globalApp = null; @@ -106,7 +106,12 @@ module.exports = ({ return; } - log.info(`app exited with code ${code}, waiting for change to restart it`); + if (code) { + log.info(`app exited with code ${code}, waiting for change to restart it`); + } + else { + log.info(`app exited due to signal (${signal}), waiting for change to restart it`); + } }); process.once('SIGTERM', onTerm);