summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/lockfile
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-09-07 14:31:04 -0500
committerisaacs <i@izs.me>2013-09-07 14:31:04 -0500
commitebeae2df518af168a8ebd9117540238f0df916a3 (patch)
treeecfedcf075d58e910f520a42407876577e4fc617 /deps/npm/node_modules/lockfile
parent1be09dfc25816acc87d96f82348d3bb3844d328e (diff)
downloadandroid-node-v8-ebeae2df518af168a8ebd9117540238f0df916a3.tar.gz
android-node-v8-ebeae2df518af168a8ebd9117540238f0df916a3.tar.bz2
android-node-v8-ebeae2df518af168a8ebd9117540238f0df916a3.zip
npm: upgrade to 1.3.11
Diffstat (limited to 'deps/npm/node_modules/lockfile')
-rw-r--r--deps/npm/node_modules/lockfile/lockfile.js16
-rw-r--r--deps/npm/node_modules/lockfile/package.json10
-rw-r--r--deps/npm/node_modules/lockfile/test/basic.js26
3 files changed, 44 insertions, 8 deletions
diff --git a/deps/npm/node_modules/lockfile/lockfile.js b/deps/npm/node_modules/lockfile/lockfile.js
index 1eecd5f798..b82f1f0d65 100644
--- a/deps/npm/node_modules/lockfile/lockfile.js
+++ b/deps/npm/node_modules/lockfile/lockfile.js
@@ -6,6 +6,12 @@ if (process.version.match(/^v0\.[0-6]/)) {
wx = c.O_TRUNC | c.O_CREAT | c.O_WRONLY | c.O_EXCL
}
+var os = require('os')
+var filetime = 'ctime'
+if (os.platform() == "win32") {
+ filetime = 'mtime'
+}
+
var debug
var util = require('util')
if (util.debuglog)
@@ -32,7 +38,7 @@ process.on('exit', function () {
// XXX https://github.com/joyent/node/issues/3555
// Remove when node 0.8 is deprecated.
-if (/^v0\.[0-8]/.test(process.version)) {
+if (/^v0\.[0-8]\./.test(process.version)) {
debug('uncaughtException, version = %s', process.version)
process.on('uncaughtException', function H (er) {
debug('uncaughtException')
@@ -86,7 +92,7 @@ exports.check = function (path, opts, cb) {
})
fs.close(fd, function (er) {
- var age = Date.now() - st.ctime.getTime()
+ var age = Date.now() - st[filetime].getTime()
return cb(er, age <= opts.stale)
})
})
@@ -119,7 +125,7 @@ exports.checkSync = function (path, opts) {
} finally {
fs.closeSync(fd)
}
- var age = Date.now() - st.ctime.getTime()
+ var age = Date.now() - st[filetime].getTime()
return (age <= opts.stale)
}
}
@@ -173,7 +179,7 @@ exports.lock = function (path, opts, cb) {
return cb(statEr)
}
- var age = Date.now() - st.ctime.getTime()
+ var age = Date.now() - st[filetime].getTime()
if (age > opts.stale) {
debug('lock stale', path, opts_)
exports.unlock(path, function (er) {
@@ -230,7 +236,7 @@ exports.lockSync = function (path, opts) {
if (opts.stale) {
var st = fs.statSync(path)
- var ct = st.ctime.getTime()
+ var ct = st[filetime].getTime()
if (!(ct % 1000) && (opts.stale % 1000)) {
// probably don't have subsecond resolution.
// round up the staleness indicator.
diff --git a/deps/npm/node_modules/lockfile/package.json b/deps/npm/node_modules/lockfile/package.json
index ea1f5a9193..39d9a857cd 100644
--- a/deps/npm/node_modules/lockfile/package.json
+++ b/deps/npm/node_modules/lockfile/package.json
@@ -1,6 +1,6 @@
{
"name": "lockfile",
- "version": "0.4.0",
+ "version": "0.4.2",
"main": "lockfile.js",
"directories": {
"test": "test"
@@ -36,6 +36,10 @@
"bugs": {
"url": "https://github.com/isaacs/lockfile/issues"
},
- "_id": "lockfile@0.4.0",
- "_from": "lockfile@latest"
+ "_id": "lockfile@0.4.2",
+ "dist": {
+ "shasum": "ab91f5d3745bc005ae4fa34d078910d1f2b9612d"
+ },
+ "_from": "lockfile@0.4.2",
+ "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-0.4.2.tgz"
}
diff --git a/deps/npm/node_modules/lockfile/test/basic.js b/deps/npm/node_modules/lockfile/test/basic.js
index fb01de3f4b..23e8248796 100644
--- a/deps/npm/node_modules/lockfile/test/basic.js
+++ b/deps/npm/node_modules/lockfile/test/basic.js
@@ -13,6 +13,7 @@ test('setup', function (t) {
try { lockFile.unlockSync('retry-lock') } catch (er) {}
try { lockFile.unlockSync('contentious-lock') } catch (er) {}
try { lockFile.unlockSync('stale-wait-lock') } catch (er) {}
+ try { lockFile.unlockSync('stale-windows-lock') } catch (er) {}
t.end()
})
@@ -249,6 +250,30 @@ test('wait and stale together', function (t) {
})
})
+
+test('stale windows file tunneling test', function (t) {
+ // for windows only
+ // nt file system tunneling feature will make file creation time not updated
+ var opts = { stale: 1000 }
+ lockFile.lockSync('stale-windows-lock')
+ setTimeout(next, 2000)
+ function next () {
+ var locked
+ lockFile.unlockSync('stale-windows-lock')
+ lockFile.lockSync('stale-windows-lock', opts)
+ locked = lockFile.checkSync('stale-windows-lock', opts)
+ t.ok(locked, "should be locked and not stale")
+ lockFile.lock('stale-windows-lock', opts, function (er) {
+ if (!er)
+ t.fail('got second lock? impossible, windows file tunneling problem!')
+ else
+ t.pass('second lock failed, windows file tunneling problem fixed')
+ t.end()
+ })
+ }
+})
+
+
test('cleanup', function (t) {
try { lockFile.unlockSync('basic-lock') } catch (er) {}
try { lockFile.unlockSync('sync-lock') } catch (er) {}
@@ -258,6 +283,7 @@ test('cleanup', function (t) {
try { lockFile.unlockSync('retry-lock') } catch (er) {}
try { lockFile.unlockSync('contentious-lock') } catch (er) {}
try { lockFile.unlockSync('stale-wait-lock') } catch (er) {}
+ try { lockFile.unlockSync('stale-windows-lock') } catch (er) {}
t.end()
})