1 | #!/usr/bin/env node
|
2 |
|
3 | const proc = require('child_process');
|
4 |
|
5 | const electron = require('./');
|
6 |
|
7 | const child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false });
|
8 | child.on('close', function (code, signal) {
|
9 | if (code === null) {
|
10 | console.error(electron, 'exited with signal', signal);
|
11 | process.exit(1);
|
12 | }
|
13 | process.exit(code);
|
14 | });
|
15 |
|
16 | const handleTerminationSignal = function (signal) {
|
17 | process.on(signal, function signalHandler () {
|
18 | if (!child.killed) {
|
19 | child.kill(signal);
|
20 | }
|
21 | });
|
22 | };
|
23 |
|
24 | handleTerminationSignal('SIGINT');
|
25 | handleTerminationSignal('SIGTERM');
|