(pid: number)
| 664 | * mistake a live daemon for a dead one and clear its lock. |
| 665 | */ |
| 666 | export function isProcessAlive(pid: number): boolean { |
| 667 | try { |
| 668 | process.kill(pid, 0); |
| 669 | return true; |
| 670 | } catch (err: unknown) { |
| 671 | const e = err as NodeJS.ErrnoException; |
| 672 | if (e.code === 'EPERM') return true; // exists, just not ours to signal |
| 673 | return false; |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * The one `listen()` error we must NOT relocate past. EADDRINUSE means the path |
no outgoing calls
no test coverage detected