electron/npm/cli.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
612 B
JavaScript
Raw Normal View History

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
const electron = require('./');
2020-10-21 22:43:52 +00:00
const child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false });
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-10-21 22:43:52 +00:00
process.exit(code);
});
const handleTerminationSignal = function (signal) {
process.on(signal, function signalHandler () {
if (!child.killed) {
2020-10-21 22:43:52 +00:00
child.kill(signal);
}
2020-10-21 22:43:52 +00:00
});
};
2020-10-21 22:43:52 +00:00
handleTerminationSignal('SIGINT');
handleTerminationSignal('SIGTERM');