зеркало из https://github.com/electron/electron.git
fix: handle SIGINT and SIGTERM from the Electron CLI helper (#13867)
Fixes #12840
This commit is contained in:
Родитель
a99cc969b5
Коммит
eb79ad4dab
11
npm/cli.js
11
npm/cli.js
|
@ -8,3 +8,14 @@ var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'})
|
|||
child.on('close', function (code) {
|
||||
process.exit(code)
|
||||
})
|
||||
|
||||
const handleTerminationSignal = function (signal) {
|
||||
process.on(signal, function signalHandler () {
|
||||
if (!child.killed) {
|
||||
child.kill(signal)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleTerminationSignal('SIGINT')
|
||||
handleTerminationSignal('SIGTERM')
|
||||
|
|
Загрузка…
Ссылка в новой задаче