MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / spawnServer

Function spawnServer

__tests__/mcp-startup-orphan.test.ts:30–49  ·  view source on GitHub ↗
(cwd: string, handshakeTimeoutMs: number)

Source from the content-addressed store, hash-verified

28const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js');
29
30function spawnServer(cwd: string, handshakeTimeoutMs: number): ChildProcessWithoutNullStreams {
31 return spawn(process.execPath, [BIN, 'serve', '--mcp'], {
32 cwd,
33 stdio: ['pipe', 'pipe', 'pipe'],
34 env: {
35 ...process.env,
36 // Direct mode: hermetic (no detached daemon to leak from the suite).
37 // The backstop is armed identically on the proxy path.
38 CODEGRAPH_NO_DAEMON: '1',
39 // Single process (skip the --liftoff-only re-exec) so exit-code and
40 // liveness assertions observe the server itself.
41 CODEGRAPH_WASM_RELAUNCHED: '1',
42 // One less helper child; the liveness watchdog is not under test.
43 CODEGRAPH_NO_WATCHDOG: '1',
44 CODEGRAPH_TELEMETRY: '0',
45 DO_NOT_TRACK: '1',
46 CODEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS: String(handshakeTimeoutMs),
47 },
48 }) as ChildProcessWithoutNullStreams;
49}
50
51function waitForExit(child: ChildProcessWithoutNullStreams, timeoutMs: number): Promise<number | null> {
52 return new Promise((resolve, reject) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected