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

Function startDetachedProcess

__tests__/daemon-registry.test.ts:45–55  ·  view source on GitHub ↗

* A live process standing in for a daemon. Its command line reads like a * CodeGraph MCP server's: one that is plainly another program would make its * lock stale (#2770).

()

Source from the content-addressed store, hash-verified

43 * lock stale (#2770).
44 */
45function startDetachedProcess(): number {
46 const source = [
47 "const { spawn } = require('child_process');",
48 "const child = spawn(process.execPath, ['-e', 'setInterval(() => {}, 1000)', 'codegraph.js', 'serve', '--mcp'], { detached: true, stdio: 'ignore' });",
49 'child.unref();',
50 'console.log(child.pid);',
51 ].join(' ');
52 const pid = Number(execFileSync(process.execPath, ['-e', source], { encoding: 'utf8' }).trim());
53 if (!Number.isInteger(pid) || pid <= 0) throw new Error('could not start daemon fixture');
54 return pid;
55}
56
57describe('daemon-registry', () => {
58 let tmpHome: string;

Callers 2

stoppingDaemonFunction · 0.70

Calls 2

NumberInterface · 0.85
joinMethod · 0.45

Tested by

no test coverage detected