fix(installer): release lock if things go south (#5125)
References #5110
This commit is contained in:
parent
b7fd0cd14c
commit
74816e4000
|
|
@ -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[]) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue