2023-06-22 14:21:42 +00:00
|
|
|
const cp = require('node:child_process');
|
2018-09-13 16:57:39 +00:00
|
|
|
const utils = require('./lib/utils');
|
|
|
|
const electronPath = utils.getAbsoluteElectronExec();
|
|
|
|
|
2018-09-28 23:17:00 +00:00
|
|
|
const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' });
|
2018-09-13 16:57:39 +00:00
|
|
|
child.on('close', (code) => process.exit(code));
|
|
|
|
|
|
|
|
const handleTerminationSignal = (signal) =>
|
|
|
|
process.on(signal, () => {
|
|
|
|
if (!child.killed) {
|
|
|
|
child.kill(signal);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
handleTerminationSignal('SIGINT');
|
|
|
|
handleTerminationSignal('SIGTERM');
|
2022-05-03 01:36:06 +00:00
|
|
|
handleTerminationSignal('SIGUSR2');
|