(pid: number)
| 126 | // The record files themselves: listDaemons leaves out a record whose pid is dead. |
| 127 | const registry = path.join(os.homedir(), '.codegraph', 'daemons'); |
| 128 | const naming = (pid: number) => { |
| 129 | let files: string[] = []; |
| 130 | try { files = fs.readdirSync(registry); } catch { return 0; } |
| 131 | return files.filter((f) => { |
| 132 | try { const r = JSON.parse(fs.readFileSync(path.join(registry, f), 'utf8')); return r.root === root && r.pid === pid; } catch { return false; } |
| 133 | }).length; |
| 134 | }; |
| 135 | try { |
| 136 | registerDaemon({ root, pid: 4343, version: '0.0.0-test', socketPath: 'x', startedAt: Date.now() }); |
| 137 | expect(naming(4343)).toBe(1); |
no test coverage detected