summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/graceful-fs
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/graceful-fs')
-rw-r--r--deps/npm/node_modules/graceful-fs/README.md12
-rw-r--r--deps/npm/node_modules/graceful-fs/fs.js11
-rw-r--r--deps/npm/node_modules/graceful-fs/graceful-fs.js5
-rw-r--r--deps/npm/node_modules/graceful-fs/package.json25
-rw-r--r--deps/npm/node_modules/graceful-fs/polyfills.js45
-rw-r--r--deps/npm/node_modules/graceful-fs/test/open.js2
-rw-r--r--deps/npm/node_modules/graceful-fs/test/readdir-sort.js2
7 files changed, 82 insertions, 20 deletions
diff --git a/deps/npm/node_modules/graceful-fs/README.md b/deps/npm/node_modules/graceful-fs/README.md
index eb1a109356..13a2e86050 100644
--- a/deps/npm/node_modules/graceful-fs/README.md
+++ b/deps/npm/node_modules/graceful-fs/README.md
@@ -7,7 +7,7 @@ The improvements are meant to normalize behavior across different
platforms and environments, and to make filesystem access more
resilient to errors.
-## Improvements over fs module
+## Improvements over [fs module](http://api.nodejs.org/fs.html)
graceful-fs:
@@ -24,3 +24,13 @@ graceful-fs:
On Windows, it retries renaming a file for up to one second if `EACCESS`
or `EPERM` error occurs, likely because antivirus software has locked
the directory.
+
+## USAGE
+
+```javascript
+// use just like fs
+var fs = require('graceful-fs')
+
+// now go and do stuff with it...
+fs.readFileSync('some-file-or-whatever')
+```
diff --git a/deps/npm/node_modules/graceful-fs/fs.js b/deps/npm/node_modules/graceful-fs/fs.js
new file mode 100644
index 0000000000..ae9fd6f61e
--- /dev/null
+++ b/deps/npm/node_modules/graceful-fs/fs.js
@@ -0,0 +1,11 @@
+// eeeeeevvvvviiiiiiillllll
+// more evil than monkey-patching the native builtin?
+// Not sure.
+
+var mod = require("module")
+var pre = '(function (exports, require, module, __filename, __dirname) { '
+var post = '});'
+var src = pre + process.binding('natives').fs + post
+var vm = require('vm')
+var fn = vm.runInThisContext(src)
+return fn(exports, require, module, __filename, __dirname)
diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js
index baf957d8b1..77fc702d80 100644
--- a/deps/npm/node_modules/graceful-fs/graceful-fs.js
+++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js
@@ -1,20 +1,17 @@
// Monkey-patching the fs module.
// It's ugly, but there is simply no other way to do this.
-var fs = module.exports = require('fs')
+var fs = module.exports = require('./fs.js')
var assert = require('assert')
// fix up some busted stuff, mostly on windows and old nodes
require('./polyfills.js')
-// The EMFILE enqueuing stuff
-
var util = require('util')
function noop () {}
var debug = noop
-var util = require('util')
if (util.debuglog)
debug = util.debuglog('gfs')
else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || ''))
diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json
index 9de02f6e3c..a77f90c7dc 100644
--- a/deps/npm/node_modules/graceful-fs/package.json
+++ b/deps/npm/node_modules/graceful-fs/package.json
@@ -6,7 +6,7 @@
},
"name": "graceful-fs",
"description": "A drop-in replacement for fs, making various improvements.",
- "version": "2.0.2",
+ "version": "3.0.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
@@ -38,11 +38,28 @@
"EACCESS"
],
"license": "BSD",
+ "gitHead": "0caa11544c0c9001db78bf593cf0c5805d149a41",
"bugs": {
"url": "https://github.com/isaacs/node-graceful-fs/issues"
},
- "readme": "ERROR: No README data found!",
"homepage": "https://github.com/isaacs/node-graceful-fs",
- "_id": "graceful-fs@2.0.2",
- "_from": "graceful-fs@latest"
+ "_id": "graceful-fs@3.0.2",
+ "_shasum": "2cb5bf7f742bea8ad47c754caeee032b7e71a577",
+ "_from": "graceful-fs@~3.0.0",
+ "_npmVersion": "1.4.14",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "2cb5bf7f742bea8ad47c754caeee032b7e71a577",
+ "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz"
+ },
+ "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz"
}
diff --git a/deps/npm/node_modules/graceful-fs/polyfills.js b/deps/npm/node_modules/graceful-fs/polyfills.js
index afc83b3f2c..9d62af5861 100644
--- a/deps/npm/node_modules/graceful-fs/polyfills.js
+++ b/deps/npm/node_modules/graceful-fs/polyfills.js
@@ -1,4 +1,4 @@
-var fs = require('fs')
+var fs = require('./fs.js')
var constants = require('constants')
var origCwd = process.cwd
@@ -116,15 +116,25 @@ if (!fs.lutimes) {
// https://github.com/isaacs/node-graceful-fs/issues/4
// Chown should not fail on einval or eperm if non-root.
+// It should not fail on enosys ever, as this just indicates
+// that a fs doesn't support the intended operation.
fs.chown = chownFix(fs.chown)
fs.fchown = chownFix(fs.fchown)
fs.lchown = chownFix(fs.lchown)
+fs.chmod = chownFix(fs.chmod)
+fs.fchmod = chownFix(fs.fchmod)
+fs.lchmod = chownFix(fs.lchmod)
+
fs.chownSync = chownFixSync(fs.chownSync)
fs.fchownSync = chownFixSync(fs.fchownSync)
fs.lchownSync = chownFixSync(fs.lchownSync)
+fs.chmodSync = chownFix(fs.chmodSync)
+fs.fchmodSync = chownFix(fs.fchmodSync)
+fs.lchmodSync = chownFix(fs.lchmodSync)
+
function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
@@ -146,15 +156,32 @@ function chownFixSync (orig) {
}
}
+// ENOSYS means that the fs doesn't support the op. Just ignore
+// that, because it doesn't matter.
+//
+// if there's no getuid, or if getuid() is something other
+// than 0, and the error is EINVAL or EPERM, then just ignore
+// it.
+//
+// This specific case is a silent failure in cp, install, tar,
+// and most other unix tools that manage permissions.
+//
+// When running as root, or if other types of errors are
+// encountered, then it's strict.
function chownErOk (er) {
- // if there's no getuid, or if getuid() is something other than 0,
- // and the error is EINVAL or EPERM, then just ignore it.
- // This specific case is a silent failure in cp, install, tar,
- // and most other unix tools that manage permissions.
- // When running as root, or if other types of errors are encountered,
- // then it's strict.
- if (!er || (!process.getuid || process.getuid() !== 0)
- && (er.code === "EINVAL" || er.code === "EPERM")) return true
+ if (!er)
+ return true
+
+ if (er.code === "ENOSYS")
+ return true
+
+ var nonroot = !process.getuid || process.getuid() !== 0
+ if (nonroot) {
+ if (er.code === "EINVAL" || er.code === "EPERM")
+ return true
+ }
+
+ return false
}
diff --git a/deps/npm/node_modules/graceful-fs/test/open.js b/deps/npm/node_modules/graceful-fs/test/open.js
index 104f36b0b9..85732f236b 100644
--- a/deps/npm/node_modules/graceful-fs/test/open.js
+++ b/deps/npm/node_modules/graceful-fs/test/open.js
@@ -2,7 +2,7 @@ var test = require('tap').test
var fs = require('../graceful-fs.js')
test('graceful fs is monkeypatched fs', function (t) {
- t.equal(fs, require('fs'))
+ t.equal(fs, require('../fs.js'))
t.end()
})
diff --git a/deps/npm/node_modules/graceful-fs/test/readdir-sort.js b/deps/npm/node_modules/graceful-fs/test/readdir-sort.js
index aeaedf1c16..fe005aa7a2 100644
--- a/deps/npm/node_modules/graceful-fs/test/readdir-sort.js
+++ b/deps/npm/node_modules/graceful-fs/test/readdir-sort.js
@@ -1,5 +1,5 @@
var test = require("tap").test
-var fs = require("fs")
+var fs = require("../fs.js")
var readdir = fs.readdir
fs.readdir = function(path, cb) {