* 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).
()
| 43 | * lock stale (#2770). |
| 44 | */ |
| 45 | function 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 | |
| 57 | describe('daemon-registry', () => { |
| 58 | let tmpHome: string; |
no test coverage detected