Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(installer): release lock if things go south (#5125)

Andrey Lushnikov74816e400040
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[]) {