electron/script/start.js
Ruben R 7dee5179cb
Handle SIGUSR2 (#33589)
`start-server-webpack-plugin` uses `SIGUSR2` to signal an HMR update to a server process: https://github.com/ericclemmons/start-server-webpack-plugin/blob/master/src/StartServerPlugin.js#L70

Note that this signal does not actually kill the child process, but merely functions as a message-passing system.
2022-05-03 10:36:06 +09:00

17 lines
507 B
JavaScript

const cp = require('child_process');
const utils = require('./lib/utils');
const electronPath = utils.getAbsoluteElectronExec();
const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' });
child.on('close', (code) => process.exit(code));
const handleTerminationSignal = (signal) =>
process.on(signal, () => {
if (!child.killed) {
child.kill(signal);
}
});
handleTerminationSignal('SIGINT');
handleTerminationSignal('SIGTERM');
handleTerminationSignal('SIGUSR2');