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>2015-03-06 05:25:01 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-03-06 05:25:01 +0300
commit8885c4dfb618f2838930b5c5149abea300a762d6 (patch)
tree4b427f2c56e22dc06f90c578884719f89030f56e /node_modules/rimraf
parent2abc3ee08f0cabc4e7bfd7b973c0b59dc44715ff (diff)
rimraf@2.3.1
* Glob arguments for better Windows support. * Handle bad symlinks properly. * Make maxBusyTries and emfileWait configurable * Also upgrade to glob@4.4.1
Diffstat (limited to 'node_modules/rimraf')
-rw-r--r--node_modules/rimraf/AUTHORS6
-rw-r--r--node_modules/rimraf/README.md10
-rw-r--r--node_modules/rimraf/package.json49
-rw-r--r--node_modules/rimraf/rimraf.js155
-rw-r--r--node_modules/rimraf/test/run.sh16
-rw-r--r--node_modules/rimraf/test/setup.sh47
-rw-r--r--node_modules/rimraf/test/test-async.js5
-rw-r--r--node_modules/rimraf/test/test-sync.js3
8 files changed, 134 insertions, 157 deletions
diff --git a/node_modules/rimraf/AUTHORS b/node_modules/rimraf/AUTHORS
deleted file mode 100644
index 247b75437..000000000
--- a/node_modules/rimraf/AUTHORS
+++ /dev/null
@@ -1,6 +0,0 @@
-# Authors sorted by whether or not they're me.
-Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)
-Wayne Larsen <wayne@larsen.st> (http://github.com/wvl)
-ritch <skawful@gmail.com>
-Marcel Laverdet
-Yosef Dinerstein <yosefd@microsoft.com>
diff --git a/node_modules/rimraf/README.md b/node_modules/rimraf/README.md
index cd123b652..58e7ac303 100644
--- a/node_modules/rimraf/README.md
+++ b/node_modules/rimraf/README.md
@@ -1,4 +1,4 @@
-`rm -rf` for node.
+The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
@@ -10,9 +10,15 @@ The callback will be called with an error if there is one. Certain
errors are handled for you:
* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
- `opts.maxBusyTries` times before giving up.
+ `opts.maxBusyTries` times before giving up, adding 100ms of wait
+ between each attempt. The default `maxBusyTries` is 3.
* `ENOENT` - If the file doesn't exist, rimraf will return
successfully, since your desired outcome is already the case.
+* `EMFILE` - Since `readdir` requires opening a file descriptor, it's
+ possible to hit `EMFILE` if too many file descriptors are in use.
+ In the sync case, there's nothing to be done for this. But in the
+ async case, rimraf will gradually back off with timeouts up to
+ `opts.emfileWait` ms, which defaults to 1000.
## rimraf.sync
diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json
index 164fc495a..a257986de 100644
--- a/node_modules/rimraf/package.json
+++ b/node_modules/rimraf/package.json
@@ -1,6 +1,6 @@
{
"name": "rimraf",
- "version": "2.2.8",
+ "version": "2.3.1",
"main": "rimraf.js",
"description": "A deep deletion module for node (like `rm -rf`)",
"author": {
@@ -22,37 +22,25 @@
"bin": {
"rimraf": "./bin.js"
},
- "contributors": [
- {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me"
- },
- {
- "name": "Wayne Larsen",
- "email": "wayne@larsen.st",
- "url": "http://github.com/wvl"
- },
- {
- "name": "ritch",
- "email": "skawful@gmail.com"
- },
- {
- "name": "Marcel Laverdet"
- },
- {
- "name": "Yosef Dinerstein",
- "email": "yosefd@microsoft.com"
- }
+ "dependencies": {
+ "glob": "^4.4.2"
+ },
+ "files": [
+ "bin.js",
+ "rimraf.js",
+ "LICENSE",
+ "README.md"
],
+ "gitHead": "aa707db2fb5b11c35fc614a1472775373dc9d46c",
"bugs": {
"url": "https://github.com/isaacs/rimraf/issues"
},
"homepage": "https://github.com/isaacs/rimraf",
- "_id": "rimraf@2.2.8",
- "_shasum": "e439be2aaee327321952730f99a8929e4fc50582",
- "_from": "rimraf@latest",
- "_npmVersion": "1.4.10",
+ "_id": "rimraf@2.3.1",
+ "_shasum": "f83df78c168d5daf9f021e8e092e7a165898ee75",
+ "_from": "rimraf@>=2.3.1 <2.4.0",
+ "_npmVersion": "2.6.0",
+ "_nodeVersion": "1.4.2",
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
@@ -64,10 +52,9 @@
}
],
"dist": {
- "shasum": "e439be2aaee327321952730f99a8929e4fc50582",
- "tarball": "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz"
+ "shasum": "f83df78c168d5daf9f021e8e092e7a165898ee75",
+ "tarball": "http://registry.npmjs.org/rimraf/-/rimraf-2.3.1.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz",
- "readme": "ERROR: No README data found!"
+ "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.3.1.tgz"
}
diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js
index eb96c46af..6dffdf064 100644
--- a/node_modules/rimraf/rimraf.js
+++ b/node_modules/rimraf/rimraf.js
@@ -4,11 +4,17 @@ rimraf.sync = rimrafSync
var assert = require("assert")
var path = require("path")
var fs = require("fs")
+var glob = require("glob")
+
+var globOpts = {
+ nosort: true,
+ nocomment: true,
+ nonegate: true,
+ silent: true
+}
// for EMFILE handling
var timeout = 0
-exports.EMFILE_MAX = 1000
-exports.BUSYTRIES_MAX = 3
var isWindows = (process.platform === "win32")
@@ -17,6 +23,7 @@ function defaults (options) {
'unlink',
'chmod',
'stat',
+ 'lstat',
'rmdir',
'readdir'
]
@@ -25,6 +32,9 @@ function defaults (options) {
m = m + 'Sync'
options[m] = options[m] || fs[m]
})
+
+ options.maxBusyTries = options.maxBusyTries || 3
+ options.emfileWait = options.emfileWait || 1000
}
function rimraf (p, options, cb) {
@@ -41,32 +51,54 @@ function rimraf (p, options, cb) {
if (!cb) throw new Error("No callback passed to rimraf()")
var busyTries = 0
- rimraf_(p, options, function CB (er) {
- if (er) {
- if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") &&
- busyTries < exports.BUSYTRIES_MAX) {
- busyTries ++
- var time = busyTries * 100
- // try again, with the same exact callback as this one.
- return setTimeout(function () {
- rimraf_(p, options, CB)
- }, time)
- }
+ var errState = null
+ var n = 0
- // this one won't happen if graceful-fs is used.
- if (er.code === "EMFILE" && timeout < exports.EMFILE_MAX) {
- return setTimeout(function () {
- rimraf_(p, options, CB)
- }, timeout ++)
- }
+ glob(p, globOpts, afterGlob)
- // already gone
- if (er.code === "ENOENT") er = null
- }
+ function next (er) {
+ errState = errState || er
+ if (--n === 0)
+ cb(errState)
+ }
- timeout = 0
- cb(er)
- })
+ function afterGlob (er, results) {
+ if (er)
+ return cb(er)
+
+ n = results.length
+ if (n === 0)
+ return cb()
+
+ results.forEach(function (p) {
+ rimraf_(p, options, function CB (er) {
+ if (er) {
+ if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") &&
+ busyTries < options.maxBusyTries) {
+ busyTries ++
+ var time = busyTries * 100
+ // try again, with the same exact callback as this one.
+ return setTimeout(function () {
+ rimraf_(p, options, CB)
+ }, time)
+ }
+
+ // this one won't happen if graceful-fs is used.
+ if (er.code === "EMFILE" && timeout < options.emfileWait) {
+ return setTimeout(function () {
+ rimraf_(p, options, CB)
+ }, timeout ++)
+ }
+
+ // already gone
+ if (er.code === "ENOENT") er = null
+ }
+
+ timeout = 0
+ next(er)
+ })
+ })
+ }
}
// Two possible strategies.
@@ -85,18 +117,28 @@ function rimraf_ (p, options, cb) {
assert(options)
assert(typeof cb === 'function')
- options.unlink(p, function (er) {
- if (er) {
- if (er.code === "ENOENT")
- return cb(null)
- if (er.code === "EPERM")
- return (isWindows)
- ? fixWinEPERM(p, options, er, cb)
- : rmdir(p, options, er, cb)
- if (er.code === "EISDIR")
- return rmdir(p, options, er, cb)
- }
- return cb(er)
+ // sunos lets the root user unlink directories, which is... weird.
+ // so we have to lstat here and make sure it's not a dir.
+ options.lstat(p, function (er, st) {
+ if (er && er.code === "ENOENT")
+ return cb(null)
+
+ if (st && st.isDirectory())
+ return rmdir(p, options, er, cb)
+
+ options.unlink(p, function (er) {
+ if (er) {
+ if (er.code === "ENOENT")
+ return cb(null)
+ if (er.code === "EPERM")
+ return (isWindows)
+ ? fixWinEPERM(p, options, er, cb)
+ : rmdir(p, options, er, cb)
+ if (er.code === "EISDIR")
+ return rmdir(p, options, er, cb)
+ }
+ return cb(er)
+ })
})
}
@@ -207,16 +249,35 @@ function rimrafSync (p, options) {
assert(p)
assert(options)
- try {
- options.unlinkSync(p)
- } catch (er) {
- if (er.code === "ENOENT")
- return
- if (er.code === "EPERM")
- return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
- if (er.code !== "EISDIR")
- throw er
- rmdirSync(p, options, er)
+ var results = glob.sync(p, globOpts)
+ if (!results.length)
+ return
+
+ for (var i = 0; i < results.length; i++) {
+ var p = results[i]
+
+ try {
+ var st = options.lstatSync(p)
+ } catch (er) {
+ if (er.code === "ENOENT")
+ return
+ }
+
+ try {
+ // sunos lets the root user unlink directories, which is... weird.
+ if (st && st.isDirectory())
+ rmdirSync(p, options, null)
+ else
+ options.unlinkSync(p)
+ } catch (er) {
+ if (er.code === "ENOENT")
+ return
+ if (er.code === "EPERM")
+ return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
+ if (er.code !== "EISDIR")
+ throw er
+ rmdirSync(p, options, er)
+ }
}
}
diff --git a/node_modules/rimraf/test/run.sh b/node_modules/rimraf/test/run.sh
deleted file mode 100644
index 653ff9b79..000000000
--- a/node_modules/rimraf/test/run.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-set -e
-code=0
-for i in test-*.js; do
- echo -n $i ...
- bash setup.sh
- node $i
- if [ -d target ]; then
- echo "fail"
- code=1
- else
- echo "pass"
- fi
-done
-rm -rf target
-exit $code
diff --git a/node_modules/rimraf/test/setup.sh b/node_modules/rimraf/test/setup.sh
deleted file mode 100644
index 2602e6316..000000000
--- a/node_modules/rimraf/test/setup.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-
-set -e
-
-files=10
-folders=2
-depth=4
-target="$PWD/target"
-
-rm -rf target
-
-fill () {
- local depth=$1
- local files=$2
- local folders=$3
- local target=$4
-
- if ! [ -d $target ]; then
- mkdir -p $target
- fi
-
- local f
-
- f=$files
- while [ $f -gt 0 ]; do
- touch "$target/f-$depth-$f"
- let f--
- done
-
- let depth--
-
- if [ $depth -le 0 ]; then
- return 0
- fi
-
- f=$folders
- while [ $f -gt 0 ]; do
- mkdir "$target/folder-$depth-$f"
- fill $depth $files $folders "$target/d-$depth-$f"
- let f--
- done
-}
-
-fill $depth $files $folders $target
-
-# sanity assert
-[ -d $target ]
diff --git a/node_modules/rimraf/test/test-async.js b/node_modules/rimraf/test/test-async.js
deleted file mode 100644
index 9c2e0b7be..000000000
--- a/node_modules/rimraf/test/test-async.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var rimraf = require("../rimraf")
- , path = require("path")
-rimraf(path.join(__dirname, "target"), function (er) {
- if (er) throw er
-})
diff --git a/node_modules/rimraf/test/test-sync.js b/node_modules/rimraf/test/test-sync.js
deleted file mode 100644
index eb71f1047..000000000
--- a/node_modules/rimraf/test/test-sync.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var rimraf = require("../rimraf")
- , path = require("path")
-rimraf.sync(path.join(__dirname, "target"))