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:
authorForrest L Norvell <forrest@npmjs.com>2014-11-12 03:37:40 +0300
committerForrest L Norvell <forrest@npmjs.com>2014-11-12 05:22:06 +0300
commit705ce601e7b9c5428353e02ebb30cb76c1991fdd (patch)
tree5797172bcde75c73d781c73ef55ccf8146c1e68f /node_modules/fs-vacuum
parent1b650f4f217c413a2ffb96e1701beb5aa67a0de2 (diff)
fs-vacuum@1.2.2
Don't complain when somebody writes to a path you're vacuuming after you've checked that it's empty, just log and bail out. Also log when somebody else wins the race to remove the empty directory.
Diffstat (limited to 'node_modules/fs-vacuum')
-rw-r--r--node_modules/fs-vacuum/package.json12
-rw-r--r--node_modules/fs-vacuum/vacuum.js9
2 files changed, 14 insertions, 7 deletions
diff --git a/node_modules/fs-vacuum/package.json b/node_modules/fs-vacuum/package.json
index 140536797..dc1516dbb 100644
--- a/node_modules/fs-vacuum/package.json
+++ b/node_modules/fs-vacuum/package.json
@@ -1,6 +1,6 @@
{
"name": "fs-vacuum",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "recursively remove empty directories -- to a point",
"main": "vacuum.js",
"scripts": {
@@ -27,7 +27,7 @@
"devDependencies": {
"mkdirp": "^0.5.0",
"tap": "^0.4.11",
- "tmp": "0.0.23"
+ "tmp": "0.0.24"
},
"dependencies": {
"graceful-fs": "^3.0.2",
@@ -35,8 +35,8 @@
},
"readme": "# fs-vacuum\n\nRemove the empty branches of a directory tree, optionally up to (but not\nincluding) a specified base directory. Optionally nukes the leaf directory.\n\n## Usage\n\n```javascript\nvar logger = require(\"npmlog\");\nvar vacuum = require(\"fs-vacuum\");\n\nvar options = {\n base : \"/path/to/my/tree/root\",\n purge : true,\n log : logger.silly.bind(logger, \"myCleanup\")\n};\n\n/* Assuming there are no other files or directories in \"out\", \"to\", or \"my\",\n * the final path will just be \"/path/to/my/tree/root\".\n */\nvacuum(\"/path/to/my/tree/root/out/to/my/files\", function (error) {\n if (error) console.error(\"Unable to cleanly vacuum:\", error.message);\n});\n```\n# vacuum(directory, options, callback)\n\n* `directory` {String} Leaf node to remove. **Must be a directory, symlink, or file.**\n* `options` {Object}\n * `base` {String} No directories at or above this level of the filesystem will be removed.\n * `purge` {Boolean} If set, nuke the whole leaf directory, including its contents.\n * `log` {Function} A logging function that takes `npmlog`-compatible argument lists.\n* `callback` {Function} Function to call once vacuuming is complete.\n * `error` {Error} What went wrong along the way, if anything.\n",
"readmeFilename": "README.md",
- "gitHead": "bad24b21c45d86b3da991f2c3d058ef03546d83e",
- "_id": "fs-vacuum@1.2.1",
- "_shasum": "1bc3c62da30d6272569b8b9089c9811abb0a600b",
- "_from": "fs-vacuum@>=1.2.1-0 <1.3.0-0"
+ "gitHead": "c788fcc30fe8e73725f4f202d86c51d23d9f3378",
+ "_id": "fs-vacuum@1.2.2",
+ "_shasum": "0e26ca2b14eb4ceb4b590a92aad585756ed18e40",
+ "_from": "fs-vacuum@>=1.2.2 <1.3.0"
}
diff --git a/node_modules/fs-vacuum/vacuum.js b/node_modules/fs-vacuum/vacuum.js
index f706a4be6..5880ae73d 100644
--- a/node_modules/fs-vacuum/vacuum.js
+++ b/node_modules/fs-vacuum/vacuum.js
@@ -90,7 +90,14 @@ function vacuum(leaf, options, cb) {
var remove = stat.isDirectory() ? rmdir : unlink
remove(branch, function (error) {
if (error) {
- if (error.code === "ENOENT") return cb(null)
+ if (error.code === "ENOENT") {
+ log("quitting because lost the race to remove", branch)
+ return cb(null)
+ }
+ if (error.code === "ENOTEMPTY") {
+ log("quitting because new (racy) entries in", branch)
+ return cb(null)
+ }
log("unable to remove", branch, "due to", error.message)
return cb(error)