* Releases the update lock if it's held by this process
()
| 252 | * Releases the update lock if it's held by this process |
| 253 | */ |
| 254 | async function releaseLock(): Promise<void> { |
| 255 | const fs = getFsImplementation() |
| 256 | const lockPath = getLockFilePath() |
| 257 | try { |
| 258 | const lockData = await fs.readFile(lockPath, { encoding: 'utf8' }) |
| 259 | if (lockData === `${process.pid}`) { |
| 260 | await fs.unlink(lockPath) |
| 261 | } |
| 262 | } catch (err) { |
| 263 | if (isENOENT(err)) { |
| 264 | return |
| 265 | } |
| 266 | logError(err as Error) |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | async function getInstallationPrefix(): Promise<string | null> { |
| 271 | // Run from home directory to avoid reading project-level .npmrc/.bunfig.toml |
no test coverage detected