Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-09-25 19:23:23 +0400
committerisaacs <i@izs.me>2012-09-25 19:23:23 +0400
commit643979090221ce18ea72c462379a7a442450d261 (patch)
tree669fc058f51efb23de0b6a8502e2d4601cddb2db /node_modules/graceful-fs
parentd8fb1ea87ed89d1903cbe7074f8ed3bf25723451 (diff)
graceful-fs@1.1.14
Diffstat (limited to 'node_modules/graceful-fs')
-rw-r--r--node_modules/graceful-fs/graceful-fs.js41
-rw-r--r--node_modules/graceful-fs/package.json6
2 files changed, 38 insertions, 9 deletions
diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js
index 5d136c27f..be9951eac 100644
--- a/node_modules/graceful-fs/graceful-fs.js
+++ b/node_modules/graceful-fs/graceful-fs.js
@@ -65,10 +65,8 @@ function open (path, flags, mode, cb) {
fs.openSync = function (path, flags, mode) {
var ret
- try {
- ret = originalOpenSync.call(fs, path, flags, mode)
- fs._curOpen ++
- } finally {}
+ ret = originalOpenSync.call(fs, path, flags, mode)
+ fs._curOpen ++
return ret
}
@@ -261,7 +259,6 @@ if (!fs.lchown) {
-
// 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.
@@ -279,3 +276,37 @@ if (process.platform === "win32") {
})
}
}
+
+
+// if read() returns EAGAIN, then just try it again.
+var read = fs.read
+fs.read = function (fd, buffer, offset, length, position, callback_) {
+ var callback
+ if (callback_ && typeof callback_ === 'function') {
+ var eagCounter = 0
+ callback = function (er, _, __) {
+ if (er && er.code === 'EAGAIN' && eagCounter < 10) {
+ eagCounter ++
+ return read.call(fs, fd, buffer, offset, length, position, callback)
+ }
+ callback_.apply(this, arguments)
+ }
+ }
+ return read.call(fs, fd, buffer, offset, length, position, callback)
+}
+
+var readSync = fs.readSync
+fs.readSync = function (fd, buffer, offset, length, position) {
+ var eagCounter = 0
+ while (true) {
+ try {
+ return readSync.call(fs, fd, buffer, offset, length, position)
+ } catch (er) {
+ if (er.code === 'EAGAIN' && eagCounter < 10) {
+ eagCounter ++
+ continue
+ }
+ throw er
+ }
+ }
+}
diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json
index 4f513626d..30f4c40ba 100644
--- a/node_modules/graceful-fs/package.json
+++ b/node_modules/graceful-fs/package.json
@@ -6,7 +6,7 @@
},
"name": "graceful-fs",
"description": "fs monkey-patching to avoid EMFILE and other problems",
- "version": "1.1.10",
+ "version": "1.1.14",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
@@ -15,11 +15,9 @@
"engines": {
"node": ">=0.4.0"
},
- "devDependencies": {},
"directories": {
"test": "test"
},
- "dependencies": {},
"scripts": {
"test": "tap test/*.js"
},
@@ -32,6 +30,6 @@
],
"license": "BSD",
"readme": "Just like node's `fs` module, but it does an incremental back-off when\nEMFILE is encountered.\n\nUseful in asynchronous situations where one needs to try to open lots\nand lots of files.\n",
- "_id": "graceful-fs@1.1.10",
+ "_id": "graceful-fs@1.1.14",
"_from": "graceful-fs@~1.1.1"
}