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