(pid: number)
| 634 | * mistake a live daemon for a dead one and clear its lock. |
| 635 | */ |
| 636 | export function isProcessAlive(pid: number): boolean { |
| 637 | try { |
| 638 | process.kill(pid, 0); |
| 639 | return true; |
| 640 | } catch (err: unknown) { |
| 641 | const e = err as NodeJS.ErrnoException; |
| 642 | if (e.code === 'EPERM') return true; // exists, just not ours to signal |
| 643 | return false; |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | /** |
| 648 | * The one `listen()` error we must NOT relocate past. EADDRINUSE means the path |
no outgoing calls
no test coverage detected