(pid: number)
| 965 | * mistake a live daemon for a dead one and clear its lock. |
| 966 | */ |
| 967 | export function isProcessAlive(pid: number): boolean { |
| 968 | try { |
| 969 | process.kill(pid, 0); |
| 970 | return true; |
| 971 | } catch (err: unknown) { |
| 972 | const e = err as NodeJS.ErrnoException; |
| 973 | if (e.code === 'EPERM') return true; // exists, just not ours to signal |
| 974 | return false; |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | /** |
| 979 | * The one `listen()` error we must NOT relocate past. EADDRINUSE means the path |
no outgoing calls
no test coverage detected