(pid: number)
| 18 | * is conservative for lock recovery (we won't steal a live lock). |
| 19 | */ |
| 20 | export function isProcessRunning(pid: number): boolean { |
| 21 | if (pid <= 1) return false |
| 22 | try { |
| 23 | process.kill(pid, 0) |
| 24 | return true |
| 25 | } catch { |
| 26 | return false |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Gets the ancestor process chain for a given process (up to maxDepth levels) |