()
| 250 | return { |
| 251 | lockPath, |
| 252 | release(): void { |
| 253 | if (released) return; |
| 254 | released = true; |
| 255 | if (!existsSync(lockPath)) return; |
| 256 | const contents = readLockContents(lockPath); |
| 257 | if (contents && contents.pid !== ownerPid) { |
| 258 | // Someone else owns the lock now — don't touch it. |
| 259 | return; |
| 260 | } |
| 261 | try { |
| 262 | unlinkSync(lockPath); |
| 263 | } catch { |
| 264 | // Best-effort: file may have vanished between existsSync and unlinkSync. |
| 265 | } |
| 266 | }, |
| 267 | updatePort(port: number): void { |
| 268 | if (!existsSync(lockPath)) return; |
| 269 | const contents = readLockContents(lockPath); |
no test coverage detected