fix(lock): nicer lockfile error (#4396)

This commit is contained in:
Joel Einbinder 2020-11-16 06:35:30 -08:00 committed by GitHub
parent 732e83f48d
commit dd3d49339d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,6 +41,7 @@ export async function installBrowsersWithProgressBar(packagePath: string) {
const browsersPath = browserPaths.browsersPath(packagePath);
await fsMkdirAsync(browsersPath, { recursive: true });
const lockfilePath = path.join(browsersPath, '__dirlock');
const releaseLock = await lockfile.lock(browsersPath, {
retries: {
retries: 10,
@ -49,7 +50,10 @@ export async function installBrowsersWithProgressBar(packagePath: string) {
// See documentation at: https://www.npmjs.com/package/retry#retrytimeoutsoptions
factor: 1.27579,
},
lockfilePath: path.join(browsersPath, '__dirlock'),
onCompromised: (err: Error) => {
throw new Error(`${err.message} Path: ${lockfilePath}`);
},
lockfilePath,
});
const linksDir = path.join(browsersPath, '.links');