Skip to content

Commit eb79ad4

Browse files
MarshallOfSoundckerr
authored andcommitted
fix: handle SIGINT and SIGTERM from the Electron CLI helper (electron#13867)
Fixes electron#12840
1 parent a99cc96 commit eb79ad4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

npm/cli.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'})
88
child.on('close', function (code) {
99
process.exit(code)
1010
})
11+
12+
const handleTerminationSignal = function (signal) {
13+
process.on(signal, function signalHandler () {
14+
if (!child.killed) {
15+
child.kill(signal)
16+
}
17+
})
18+
}
19+
20+
handleTerminationSignal('SIGINT')
21+
handleTerminationSignal('SIGTERM')

0 commit comments

Comments
 (0)