A daemon process for the project, started the way a launcher starts one.
(env: NodeJS.ProcessEnv)
| 512 | |
| 513 | /** A daemon process for the project, started the way a launcher starts one. */ |
| 514 | function startDaemon(env: NodeJS.ProcessEnv): { child: ChildProcessWithoutNullStreams; log: string[] } { |
| 515 | const child = spawn(process.execPath, [...WASM_RUNTIME_FLAGS, BIN, 'serve', '--mcp', '--path', realRoot], { |
| 516 | cwd: tempDir, |
| 517 | stdio: ['pipe', 'pipe', 'pipe'], |
| 518 | env: { ...process.env, CODEGRAPH_DAEMON_INTERNAL: '1', CODEGRAPH_DAEMON_IDLE_TIMEOUT_MS: '30000', ...env }, |
| 519 | }) as ChildProcessWithoutNullStreams; |
| 520 | child.on('error', () => { /* ignore */ }); |
| 521 | child.stdout.resume(); |
| 522 | const log: string[] = []; |
| 523 | lines(child.stderr, log); |
| 524 | daemonPids.add(child.pid!); |
| 525 | return { child, log }; |
| 526 | } |
| 527 | |
| 528 | /** The slot as a launcher that just stopped an older daemon holds it: this test process stands in. */ |
| 529 | function holdWriterSlotForSuccessor(): string { |