()
| 70 | * Get the path to the daemon executable. |
| 71 | */ |
| 72 | export function getDaemonExecutablePath(): string { |
| 73 | // In the built output, this file is build/cli/daemon-control.js and daemon is build/daemon.js. |
| 74 | const currentFile = fileURLToPath(import.meta.url); |
| 75 | const buildDir = dirname(currentFile); |
| 76 | const candidateJs = resolve(buildDir, '..', 'daemon.js'); |
| 77 | if (existsSync(candidateJs)) { |
| 78 | return candidateJs; |
| 79 | } |
| 80 | |
| 81 | // Fallback for source/dev layouts. |
| 82 | return resolve(buildDir, '..', 'daemon.ts'); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Force-stop a daemon that cannot be stopped gracefully (e.g. protocol version mismatch). |
no test coverage detected