2015-04-23 19:37:31 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2020-10-21 22:43:52 +00:00
|
|
|
const proc = require('child_process');
|
2015-04-23 19:37:31 +00:00
|
|
|
|
2024-10-03 02:10:44 +00:00
|
|
|
const electron = require('./');
|
|
|
|
|
2020-10-21 22:43:52 +00:00
|
|
|
const child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false });
|
2020-04-13 06:49:01 +00:00
|
|
|
child.on('close', function (code, signal) {
|
|
|
|
if (code === null) {
|
2020-10-21 22:43:52 +00:00
|
|
|
console.error(electron, 'exited with signal', signal);
|
|
|
|
process.exit(1);
|
2020-04-13 06:49:01 +00:00
|
|
|
}
|
2020-10-21 22:43:52 +00:00
|
|
|
process.exit(code);
|
|
|
|
});
|
2018-07-31 18:44:04 +00:00
|
|
|
|
|
|
|
const handleTerminationSignal = function (signal) {
|
|
|
|
process.on(signal, function signalHandler () {
|
|
|
|
if (!child.killed) {
|
2020-10-21 22:43:52 +00:00
|
|
|
child.kill(signal);
|
2018-07-31 18:44:04 +00:00
|
|
|
}
|
2020-10-21 22:43:52 +00:00
|
|
|
});
|
|
|
|
};
|
2018-07-31 18:44:04 +00:00
|
|
|
|
2020-10-21 22:43:52 +00:00
|
|
|
handleTerminationSignal('SIGINT');
|
|
|
|
handleTerminationSignal('SIGTERM');
|