mirror of
https://github.com/electron/electron.git
synced 2026-01-07 22:54:25 -05:00
24 lines
567 B
JavaScript
24 lines
567 B
JavaScript
const cp = require('node:child_process');
|
|
|
|
const utils = require('./lib/utils');
|
|
|
|
const electronPath = utils.getAbsoluteElectronExec();
|
|
|
|
const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
let childClosed = false;
|
|
child.on('close', (code) => {
|
|
childClosed = true;
|
|
process.exit(code);
|
|
});
|
|
|
|
const handleTerminationSignal = (signal) =>
|
|
process.on(signal, () => {
|
|
if (!childClosed) {
|
|
child.kill(signal);
|
|
}
|
|
});
|
|
|
|
handleTerminationSignal('SIGINT');
|
|
handleTerminationSignal('SIGTERM');
|
|
handleTerminationSignal('SIGUSR2');
|