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

References #5110
This commit is contained in:
Andrey Lushnikov 2021-01-22 17:27:33 -08:00 committed by GitHub
parent b7fd0cd14c
commit 74816e4000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,11 +57,14 @@ export async function installBrowsersWithProgressBar(packagePath: string, browse
});
const linksDir = path.join(browsersPath, '.links');
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[]) {
// 1. Collect used downloads and package descriptors.