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