The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import * as NodeChildProcess from "node:child_process"; |
| 2 | import * as NodePath from "node:path"; |
| 3 | |
| 4 | import { desktopDir, resolveElectronLaunchCommand } from "./electron-launcher.mjs"; |
| 5 | |
| 6 | NodeChildProcess.execFileSync( |
| 7 | process.execPath, |
| 8 | [NodePath.join(desktopDir, "scripts/build-browser-secret.mjs")], |
| 9 | { stdio: "inherit" }, |
| 10 | ); |
| 11 | NodeChildProcess.execFileSync( |
| 12 | process.execPath, |
| 13 | [NodePath.join(desktopDir, "scripts/build-apple-speech.mjs")], |
| 14 | { stdio: "inherit" }, |
| 15 | ); |
| 16 | |
| 17 | const childEnv = { ...process.env }; |
| 18 | delete childEnv.ELECTRON_RUN_AS_NODE; |
| 19 | |
| 20 | const electronCommand = resolveElectronLaunchCommand(["dist-electron/main.cjs"]); |
| 21 | const child = NodeChildProcess.spawn(electronCommand.electronPath, electronCommand.args, { |
| 22 | stdio: "inherit", |
| 23 | cwd: desktopDir, |
| 24 | env: childEnv, |
| 25 | }); |
| 26 | |
| 27 | child.on("exit", (code, signal) => { |
| 28 | if (signal) { |
| 29 | process.kill(process.pid, signal); |
| 30 | return; |
| 31 | } |
| 32 | process.exit(code ?? 0); |
| 33 | }); |