(pid: number)
| 112 | } |
| 113 | |
| 114 | function isAlive(pid: number): boolean { |
| 115 | if (!Number.isInteger(pid) || pid <= 0) return false; |
| 116 | try { |
| 117 | process.kill(pid, 0); |
| 118 | return true; |
| 119 | } catch (err: unknown) { |
| 120 | const e = err as { code?: string }; |
| 121 | return e.code !== 'ESRCH'; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Spawn a daemon process and wait for the READY line. Returns the port the |