(pid: number)
| 841 | * mistake a live daemon for a dead one and clear its lock. |
| 842 | */ |
| 843 | export function isProcessAlive(pid: number): boolean { |
| 844 | try { |
| 845 | process.kill(pid, 0); |
| 846 | return true; |
| 847 | } catch (err: unknown) { |
| 848 | const e = err as NodeJS.ErrnoException; |
| 849 | if (e.code === 'EPERM') return true; // exists, just not ours to signal |
| 850 | return false; |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | /** |
| 855 | * The one `listen()` error we must NOT relocate past. EADDRINUSE means the path |
no outgoing calls
no test coverage detected