diff options
author | isaacs <i@izs.me> | 2013-02-06 04:26:20 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-02-06 04:26:20 +0400 |
commit | 4776734b2cc11a5003899bfde799b51ca7aab4c3 (patch) | |
tree | 1e8abdb69189469b64fe0a90d70e635eacc9d5b4 /node_modules | |
parent | 82fcfc8a6b914c76488d93f6c1a5dfdc03e6ebe2 (diff) |
rimraf@2.1.3
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/rimraf/package.json | 8 | ||||
-rw-r--r-- | node_modules/rimraf/rimraf.js | 26 | ||||
-rw-r--r-- | node_modules/rimraf/test/test-fiber.js | 0 |
3 files changed, 24 insertions, 10 deletions
diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json index 3063a89d5..d60c92ede 100644 --- a/node_modules/rimraf/package.json +++ b/node_modules/rimraf/package.json @@ -1,6 +1,6 @@ { "name": "rimraf", - "version": "2.1.2", + "version": "2.1.3", "main": "rimraf.js", "description": "A deep deletion module for node (like `rm -rf`)", "author": { @@ -13,7 +13,7 @@ "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE" }, "optionalDependencies": { - "graceful-fs": "~1.1" + "graceful-fs": "~1" }, "repository": { "type": "git", @@ -47,9 +47,9 @@ ], "readme": "A `rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, callback)`\n\nThe callback will be called with an error if there is one. Certain\nerrors are handled for you:\n\n* `EBUSY` - rimraf will back off a maximum of opts.maxBusyTries times\n before giving up.\n* `EMFILE` - If too many file descriptors get opened, rimraf will\n patiently wait until more become available.\n\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too. But that's not so good. Use\nthe async API. It's better.\n", "readmeFilename": "README.md", - "_id": "rimraf@2.1.2", + "_id": "rimraf@2.1.3", "dependencies": { - "graceful-fs": "~1.1" + "graceful-fs": "~1" }, "_from": "rimraf@2" } diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js index 6a67fb430..6c8bf98ec 100644 --- a/node_modules/rimraf/rimraf.js +++ b/node_modules/rimraf/rimraf.js @@ -63,16 +63,20 @@ function rimraf_ (p, cb) { if (er && er.code === "ENOENT") return cb() if (er && (er.code === "EPERM" || er.code === "EISDIR")) - return rmdir(p, cb) + return rmdir(p, er, cb) return cb(er) }) } -function rmdir (p, cb) { +function rmdir (p, originalEr, cb) { // try to rmdir first, and only readdir on ENOTEMPTY + // if we guessed wrong, and it's not a directory, then + // raise the original error. fs.rmdir(p, function (er) { if (er && er.code === "ENOTEMPTY") rmkids(p, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) else cb(er) }) @@ -110,9 +114,19 @@ function rimrafSync (p) { return if (er.code !== "EPERM" && er.code !== "EISDIR") throw er - fs.readdirSync(p).forEach(function (f) { - rimrafSync(path.join(p, f)) - }) - fs.rmdirSync(p) + try { + fs.rmdirSync(p) + } catch (er2) { + if (er2.code === "ENOENT") + return + if (er2.code === "ENOTDIR") + throw er + if (er2.code === "ENOTEMPTY") { + fs.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f)) + }) + fs.rmdirSync(p) + } + } } } diff --git a/node_modules/rimraf/test/test-fiber.js b/node_modules/rimraf/test/test-fiber.js deleted file mode 100644 index e69de29bb..000000000 --- a/node_modules/rimraf/test/test-fiber.js +++ /dev/null |