Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

graceful-fs@1.1.14

  • Loading branch information...
commit 643979090221ce18ea72c462379a7a442450d261 1 parent d8fb1ea
isaacs isaacs authored
41 node_modules/graceful-fs/graceful-fs.js
View
@@ -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
+ }
+ }
+}
6 node_modules/graceful-fs/package.json
View
@@ -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"
}
Please sign in to comment.
Something went wrong with that request. Please try again.