-
Notifications
You must be signed in to change notification settings - Fork 515
Expand file tree
/
Copy pathlaunch.js
More file actions
23 lines (19 loc) · 859 Bytes
/
Copy pathlaunch.js
File metadata and controls
23 lines (19 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env node
// Cross-platform launcher that ensures Electron runs in GUI mode.
//
// Claude Code (and other Electron-based tools) set ELECTRON_RUN_AS_NODE=1,
// which forces Electron to behave as a plain Node.js process — the browser
// layer never initializes, so `require("electron").app` is undefined.
//
// This launcher strips that variable before spawning the real Electron binary.
const { spawn } = require("child_process");
const electron = require("electron");
const { buildElectronLaunchConfig } = require("./hooks/shared-process");
const forwardedArgs = process.argv.slice(2);
const launchConfig = buildElectronLaunchConfig(__dirname, { forwardedArgs });
const child = spawn(electron, launchConfig.args, {
stdio: "inherit",
env: launchConfig.env,
cwd: launchConfig.cwd,
});
child.on("close", (code) => process.exit(code ?? 0));