diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-03 01:33:53 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-03 01:33:53 +0100 |
commit | d1291f67551c58168af43698a359cb5ddfd266b0 (patch) | |
tree | 55a13ed29fe1915e3f42f1b1b7038dafa2e975a7 /node_modules/graceful-fs/polyfills.js | |
parent | d0a0695fb5d34996850723f7d4b1b59c3df909c2 (diff) | |
download | wallet-core-d1291f67551c58168af43698a359cb5ddfd266b0.tar.xz |
node_modules
Diffstat (limited to 'node_modules/graceful-fs/polyfills.js')
-rw-r--r-- | node_modules/graceful-fs/polyfills.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index cf474df73..ab6b32b67 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -80,15 +80,27 @@ function patch (fs) { // 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. + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. if (process.platform === "win32") { fs.rename = (function (fs$rename) { return function (from, to, cb) { var start = Date.now() + var backoff = 0; fs$rename(from, to, function CB (er) { if (er && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 1000) { - return fs$rename(from, to, CB) + && Date.now() - start < 60000) { + setTimeout(function() { + fs$rename(from, to, CB); + }, backoff) + if (backoff < 100) + backoff += 10; + return; } if (cb) cb(er) }) |