@pnpm/fs-locker
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -5,4 +5,4 @@ export default function withLock<T>(dir: string, opts: { | ||
whenLocked?: () => void; | ||
}): Promise<(() => Promise<{}>) & { | ||
}): Promise<(() => Promise<void>) & { | ||
sync: () => void; | ||
}>; |
@@ -21,4 +21,22 @@ "use strict"; | ||
await lockfile.lock(lockFilename, { realpath: false, stale: opts.stale }); | ||
const unlockThis = () => lockfile.unlock(lockFilename, { realpath: false }); | ||
unlockThis['sync'] = () => lockfile.unlockSync(lockFilename, { realpath: false }); // tslint:disable-line | ||
async function unlockThis() { | ||
try { | ||
await lockfile.unlock(lockFilename, { realpath: false }); | ||
} | ||
catch (err) { | ||
// We don't care if the folder was not locked or already unlocked | ||
if (err.code !== 'ENOTACQUIRED') | ||
throw err; | ||
} | ||
} | ||
unlockThis['sync'] = function unlockSync() { | ||
try { | ||
lockfile.unlockSync(lockFilename, { realpath: false }); | ||
} | ||
catch (err) { | ||
// We don't care if the folder was not locked or already unlocked | ||
if (err.code !== 'ENOTACQUIRED') | ||
throw err; | ||
} | ||
}; | ||
return unlockThis; | ||
@@ -25,0 +43,0 @@ } |
{ | ||
"name": "@pnpm/fs-locker", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "An fs locker for pnpm", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7273
66