* Release the lock
()
| 616 | * Release the lock |
| 617 | */ |
| 618 | release(): void { |
| 619 | if (!this.held) return; |
| 620 | try { |
| 621 | // Only remove if we still own it (check PID) |
| 622 | const content = readRegularFileSync(this.lockPath, 'utf-8').trim(); |
| 623 | if (parseInt(content, 10) === process.pid) { |
| 624 | fs.unlinkSync(this.lockPath); |
| 625 | } |
| 626 | } catch { |
| 627 | // Lock file already gone - that's fine |
| 628 | } |
| 629 | this.held = false; |
| 630 | } |
| 631 | |
| 632 | /** |
| 633 | * Execute a function while holding the lock |
no test coverage detected