electron/npm/cli.js

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

26 строки
612 B
JavaScript
Исходник Постоянная ссылка Обычный вид История

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 });
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-10-22 01:43:52 +03:00
process.exit(code);
});
const handleTerminationSignal = function (signal) {
process.on(signal, function signalHandler () {
if (!child.killed) {
2020-10-22 01:43:52 +03:00
child.kill(signal);
}
2020-10-22 01:43:52 +03:00
});
};
2020-10-22 01:43:52 +03:00
handleTerminationSignal('SIGINT');
handleTerminationSignal('SIGTERM');