7dee5179cb
`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.
17 lines
507 B
JavaScript
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');
|