electron/script/start.js

20 lines
514 B
JavaScript
Raw Normal View History

const cp = require('node:child_process');
2020-03-20 20:28:31 +00:00
const utils = require('./lib/utils');
2020-03-20 20:28:31 +00:00
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');