* Checks if a process is still running (only works on same machine). * Uses Node.js process.kill(pid, 0) which doesn't actually kill but checks existence.
(pid: number)
| 22 | * Uses Node.js process.kill(pid, 0) which doesn't actually kill but checks existence. |
| 23 | */ |
| 24 | function isProcessRunning(pid: number): boolean { |
| 25 | try { |
| 26 | // Signal 0 doesn't kill, just checks if process exists |
| 27 | process.kill(pid, 0); |
| 28 | return true; |
| 29 | } catch { |
| 30 | return false; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Checks if a lock is stale based on Restic's algorithm: |