UNPKG

612 BJavaScriptView Raw
1#!/usr/bin/env node
2
3const proc = require('child_process');
4
5const electron = require('./');
6
7const child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false });
8child.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
16const handleTerminationSignal = function (signal) {
17 process.on(signal, function signalHandler () {
18 if (!child.killed) {
19 child.kill(signal);
20 }
21 });
22};
23
24handleTerminationSignal('SIGINT');
25handleTerminationSignal('SIGTERM');