diff --git a/src/main/main.ts b/src/main/main.ts index 990a255..8c2c9fc 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -10,9 +10,8 @@ const DEFAULT_DASHBOARD_ROUTE = process.env.SCOREKO_DASHBOARD_ROUTE ?? "dashboar const DEFAULT_LOADING_ROUTE = process.env.SCOREKO_LOADING_ROUTE ?? "dashboard/loading/main.html?standalone=true"; const LOAD_DELAY_MS = parseEnvInt("ELECTRON_LOAD_DELAY_MS", 10000); const STARTUP_TIMEOUT_MS = parseEnvInt("NODECG_STARTUP_TIMEOUT_MS", 30000); -const USE_SYSTEM_NODE = (process.env.NODECG_USE_SYSTEM_NODE ?? "false").toLowerCase() === "true"; -const NODE_BINARY = process.env.NODECG_NODE_BINARY ?? "node"; const NODECG_KILL_TIMEOUT_MS = parseEnvInt("NODECG_KILL_TIMEOUT_MS", 2500); +const NODECG_RUNTIME_NAME = "electron internal node"; const isDev = !app.isPackaged; const rootPath = isDev ? path.resolve(__dirname, "../..") : process.resourcesPath; @@ -146,16 +145,13 @@ function startNodeCG(): ChildProcess { validateNodeCGInstall(); const indexPath = path.join(nodecgPath, "index.js"); - const runtimeBinary = USE_SYSTEM_NODE ? NODE_BINARY : process.execPath; - const runtimeName = USE_SYSTEM_NODE ? `system node (${NODE_BINARY})` : "electron internal node"; - - const child = spawn(runtimeBinary, [indexPath], { + const child = spawn(process.execPath, [indexPath], { cwd: nodecgPath, env: { ...process.env, NODE_ENV: isDev ? "development" : "production", NODECG_PORT: DEFAULT_NODECG_PORT, - ...(USE_SYSTEM_NODE ? {} : { ELECTRON_RUN_AS_NODE: "1" }), + ELECTRON_RUN_AS_NODE: "1", }, stdio: ["ignore", "pipe", "pipe"], detached: process.platform !== "win32", @@ -172,7 +168,7 @@ function startNodeCG(): ChildProcess { process.stderr.write(text); }); - log(`NodeCG started with pid=${child.pid} using ${runtimeName}`); + log(`NodeCG started with pid=${child.pid} using ${NODECG_RUNTIME_NAME}`); child.on("exit", (code, signal) => { log(`NodeCG exited code=${code} signal=${signal ?? "none"}`);