Skip to content

Commit 1746ae8

Browse files
authored
fix: do not ignore electron exit signals in cli.js wrapper (electron#22878)
When the electron child process exits with a signal, the close event handler receives code null and the cli wrapper would silently exit successfully. Fix it to log a message and exit with a nonzero code in this case. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
1 parent 27d6266 commit 1746ae8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

npm/cli.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ var electron = require('./')
55
var proc = require('child_process')
66

77
var child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false })
8-
child.on('close', function (code) {
8+
child.on('close', function (code, signal) {
9+
if (code === null) {
10+
console.error(electron, 'exited with signal', signal)
11+
process.exit(1)
12+
}
913
process.exit(code)
1014
})
1115

0 commit comments

Comments
 (0)