(pid: number)
| 80 | * Uses signal 0 which doesn't actually send a signal but checks if we can |
| 81 | */ |
| 82 | export function isProcessRunning(pid: number): boolean { |
| 83 | // PID 0 is special - it refers to the current process group, not a real process |
| 84 | // PID 1 is init/systemd and is always running but shouldn't be considered for locks |
| 85 | if (pid <= 1) { |
| 86 | return false |
| 87 | } |
| 88 | |
| 89 | try { |
| 90 | process.kill(pid, 0) |
| 91 | return true |
| 92 | } catch { |
| 93 | return false |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Validate that a running process is actually a Claude process |
no test coverage detected