()
| 498 | } |
| 499 | |
| 500 | private cleanupLockfile(): void { |
| 501 | try { |
| 502 | if (fs.existsSync(this.pidPath)) { |
| 503 | // Only remove if it still belongs to us — another daemon may have |
| 504 | // already taken over while we were shutting down (extremely rare). |
| 505 | const raw = fs.readFileSync(this.pidPath, 'utf8'); |
| 506 | const info = decodeLockInfo(raw); |
| 507 | if (info && info.pid === process.pid) { |
| 508 | fs.unlinkSync(this.pidPath); |
| 509 | } |
| 510 | } |
| 511 | } catch { /* best-effort; we're exiting anyway */ } |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | /** |
no test coverage detected