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

Function waitForExit

__tests__/mcp-startup-orphan.test.ts:51–60  ·  view source on GitHub ↗
(child: ChildProcessWithoutNullStreams, timeoutMs: number)

Source from the content-addressed store, hash-verified

49}
50
51function waitForExit(child: ChildProcessWithoutNullStreams, timeoutMs: number): Promise<number | null> {
52 return new Promise((resolve, reject) => {
53 if (child.exitCode !== null) { resolve(child.exitCode); return; }
54 const timer = setTimeout(
55 () => reject(new Error(`server did not exit within ${timeoutMs}ms`)),
56 timeoutMs
57 );
58 child.on('exit', (code) => { clearTimeout(timer); resolve(code); });
59 });
60}
61
62const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
63

Callers 1

Calls 2

onMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected