diff options
author | isaacs <i@izs.me> | 2012-03-29 06:36:44 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-03-29 06:36:44 +0400 |
commit | cda3b6ff52e78b61c25f1e04ff9f6f5f5046dec0 (patch) | |
tree | 132f27b87f4234acdb22344128046e9eb0703ae8 /deps/npm/node_modules/graceful-fs/graceful-fs.js | |
parent | b031671138a6b997e934cfafa17f03247c036c71 (diff) |
Upgrade npm to 1.1.14
Diffstat (limited to 'deps/npm/node_modules/graceful-fs/graceful-fs.js')
-rw-r--r-- | deps/npm/node_modules/graceful-fs/graceful-fs.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 8081047686f..ecbda31a5a5 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -6,8 +6,7 @@ var fs = require("fs") // there is such a thing as TOO graceful. if (fs.open === gracefulOpen) return -var FastList = require("fast-list") - , queue = new FastList() +var queue = [] , curOpen = 0 , constants = require("constants") @@ -254,3 +253,23 @@ function chownErOk (er) { if (!er || (!process.getuid || process.getuid() !== 0) && (er.code === "EINVAL" || er.code === "EPERM")) return true } + + + +// on Windows, A/V software can lock the directory, causing this +// to fail with an EACCES or EPERM if the directory contains newly +// created files. Try again on failure, for up to 1 second. +if (process.platform === "win32") { + var rename_ = fs.rename + fs.rename = function rename (from, to, cb) { + var start = Date.now() + rename_(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 1000) { + return rename_(from, to, CB) + } + cb(er) + }) + } +} |