diff --git a/src/install/installer.ts b/src/install/installer.ts index a11d777222..ece657f83d 100644 --- a/src/install/installer.ts +++ b/src/install/installer.ts @@ -57,10 +57,13 @@ export async function installBrowsersWithProgressBar(packagePath: string, browse }); const linksDir = path.join(browsersPath, '.links'); - await fsMkdirAsync(linksDir, { recursive: true }); - await fsWriteFileAsync(path.join(linksDir, sha1(packagePath)), packagePath); - await validateCache(packagePath, browsersPath, linksDir, browserNames); - await releaseLock(); + try { + await fsMkdirAsync(linksDir, { recursive: true }); + await fsWriteFileAsync(path.join(linksDir, sha1(packagePath)), packagePath); + await validateCache(packagePath, browsersPath, linksDir, browserNames); + } finally { + await releaseLock(); + } } async function validateCache(packagePath: string, browsersPath: string, linksDir: string, browserNames?: browserPaths.BrowserName[]) {