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

Function startDetachedProcess

__tests__/index-command.test.ts:68–78  ·  view source on GitHub ↗

* A live process standing in for a daemon that does not answer its socket. * Its command line reads like a CodeGraph MCP server's: one that is plainly * some other program would make the lock stale, and `index` would clear it * (#2770).

()

Source from the content-addressed store, hash-verified

66 * (#2770).
67 */
68function startDetachedProcess(): number {
69 const source = [
70 "const { spawn } = require('child_process');",
71 "const child = spawn(process.execPath, ['-e', 'setInterval(() => {}, 1000)', 'codegraph.js', 'serve', '--mcp'], { detached: true, stdio: 'ignore' });",
72 'child.unref();',
73 'console.log(child.pid);',
74 ].join(' ');
75 const pid = Number(execFileSync(process.execPath, ['-e', source], { encoding: 'utf8' }).trim());
76 if (!Number.isInteger(pid) || pid <= 0) throw new Error('could not start daemon fixture');
77 return pid;
78}
79
80describe('codegraph index — full re-index keeps the graph populated (#874)', () => {
81 let tempDir: string;

Callers 1

Calls 2

NumberInterface · 0.85
joinMethod · 0.45

Tested by

no test coverage detected