-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlaunch.js
More file actions
25 lines (21 loc) · 781 Bytes
/
Copy pathlaunch.js
File metadata and controls
25 lines (21 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
// Launch script: ensures ELECTRON_RUN_AS_NODE is removed before starting Electron.
// VSCode's integrated terminal sets this env var, which forces electron.exe
// into plain Node.js mode, breaking require('electron').
const { spawn } = require('child_process');
const electronPath = require('electron');
delete process.env.ELECTRON_RUN_AS_NODE;
const child = spawn(electronPath, ['.', ...process.argv.slice(2)], {
stdio: 'inherit',
env: process.env
});
child.on('close', (code, signal) => {
if (code === null) {
console.error('electron exited with signal', signal);
process.exit(1);
}
process.exit(code);
});
['SIGINT', 'SIGTERM'].forEach(sig => {
process.on(sig, () => { if (!child.killed) child.kill(sig); });
});