proper-lockfile
Advanced tools
Comparing version 0.1.3 to 0.1.4
10
index.js
@@ -160,3 +160,5 @@ 'use strict'; | ||
callback(null, remove.bind(null, file, options)); | ||
callback(null, function (unlockCallback) { | ||
remove(file, options, unlockCallback || function () {}); | ||
}); | ||
}, compromised); | ||
@@ -183,3 +185,3 @@ }); | ||
if (err) { | ||
return callback && callback(err); | ||
return callback(err); | ||
} | ||
@@ -198,6 +200,6 @@ | ||
if (err && err.code !== 'ENOENT') { | ||
return callback && callback(err); | ||
return callback(err); | ||
} | ||
callback && callback(); | ||
callback(); | ||
}); | ||
@@ -204,0 +206,0 @@ }); |
{ | ||
"name": "proper-lockfile", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A lockfile utility based on fs that works cross process and machine (network file systems)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -328,2 +328,25 @@ 'use strict'; | ||
}); | ||
it('should release the lock after calling the provided unlock function (without callback)', function (next) { | ||
this.timeout(5000); | ||
lockfile.lock(tmpFile, function (err, unlock) { | ||
expect(err).to.not.be.ok(); | ||
lockfile.lock(tmpFile, function (err) { | ||
expect(err).to.be.an(Error); | ||
expect(err.code).to.be('ELOCK'); | ||
unlock(); | ||
setTimeout(function () { | ||
lockfile.lock(tmpFile, function (err) { | ||
expect(err).to.not.be.ok(); | ||
next(); | ||
}, next); | ||
}, 2000); | ||
}, next); | ||
}, next); | ||
}); | ||
}); | ||
@@ -330,0 +353,0 @@ |
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
34840
707