forked from rullerzhou-afk/clawd-on-desk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.js
More file actions
25 lines (20 loc) · 796 Bytes
/
Copy pathlaunch.js
File metadata and controls
25 lines (20 loc) · 796 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
// 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 path = require("path");
const electron = require("electron");
const env = { ...process.env };
delete env.ELECTRON_RUN_AS_NODE;
const args = process.platform === "linux" ? [".", "--no-sandbox"] : ["."];
const child = spawn(electron, args, {
stdio: "inherit",
env,
cwd: __dirname,
});
child.on("close", (code) => process.exit(code ?? 0));