fix(installer): release lock if things go south (#5125)
References #5110
This commit is contained in:
parent
b7fd0cd14c
commit
74816e4000
|
|
@ -57,11 +57,14 @@ export async function installBrowsersWithProgressBar(packagePath: string, browse
|
||||||
});
|
});
|
||||||
const linksDir = path.join(browsersPath, '.links');
|
const linksDir = path.join(browsersPath, '.links');
|
||||||
|
|
||||||
|
try {
|
||||||
await fsMkdirAsync(linksDir, { recursive: true });
|
await fsMkdirAsync(linksDir, { recursive: true });
|
||||||
await fsWriteFileAsync(path.join(linksDir, sha1(packagePath)), packagePath);
|
await fsWriteFileAsync(path.join(linksDir, sha1(packagePath)), packagePath);
|
||||||
await validateCache(packagePath, browsersPath, linksDir, browserNames);
|
await validateCache(packagePath, browsersPath, linksDir, browserNames);
|
||||||
|
} finally {
|
||||||
await releaseLock();
|
await releaseLock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function validateCache(packagePath: string, browsersPath: string, linksDir: string, browserNames?: browserPaths.BrowserName[]) {
|
async function validateCache(packagePath: string, browsersPath: string, linksDir: string, browserNames?: browserPaths.BrowserName[]) {
|
||||||
// 1. Collect used downloads and package descriptors.
|
// 1. Collect used downloads and package descriptors.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue