electron/script/start.js

18 lines
507 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const cp = require('child_process');
const utils = require('./lib/utils');
const electronPath = utils.getAbsoluteElectronExec();
2020-03-20 20:28:31 +00:00
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) {
2020-03-20 20:28:31 +00:00
child.kill(signal);
}
2020-03-20 20:28:31 +00:00
});
2020-03-20 20:28:31 +00:00
handleTerminationSignal('SIGINT');
handleTerminationSignal('SIGTERM');
handleTerminationSignal('SIGUSR2');