* Check whether a process is still running (signal 0 probe). * * Note: there is a small window for PID reuse — if the owning process * exits and an unrelated process is assigned the same PID, the check * will return true. This is extremely unlikely in practice.
(pid: number)
| 63 | * will return true. This is extremely unlikely in practice. |
| 64 | */ |
| 65 | function isProcessRunning(pid: number): boolean { |
| 66 | try { |
| 67 | process.kill(pid, 0) |
| 68 | return true |
| 69 | } catch { |
| 70 | return false |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Attempt to create the lock file atomically with O_EXCL. |
no test coverage detected