summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/rimraf/rimraf.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-04-12 21:47:49 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2017-04-25 10:52:01 -0400
commit00842604483e4c2e622dfdb3a97440e07646158f (patch)
treef3346902636a44b6037652523767636bf7e4f2c9 /deps/npm/node_modules/rimraf/rimraf.js
parent061c5da010e0d249379618382a499840d38247b8 (diff)
downloadnode-new-00842604483e4c2e622dfdb3a97440e07646158f.tar.gz
deps: upgrade npm to 4.5.0
PR-URL: https://github.com/nodejs/node/pull/12480 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/node_modules/rimraf/rimraf.js')
-rw-r--r--deps/npm/node_modules/rimraf/rimraf.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/deps/npm/node_modules/rimraf/rimraf.js b/deps/npm/node_modules/rimraf/rimraf.js
index 5d9a5768a4..c26331265a 100644
--- a/deps/npm/node_modules/rimraf/rimraf.js
+++ b/deps/npm/node_modules/rimraf/rimraf.js
@@ -85,7 +85,7 @@ function rimraf (p, options, cb) {
results.forEach(function (p) {
rimraf_(p, options, function CB (er) {
if (er) {
- if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
+ if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
busyTries < options.maxBusyTries) {
busyTries ++
var time = busyTries * 100
@@ -310,6 +310,7 @@ function rimrafSync (p, options) {
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
if (er.code !== "EISDIR")
throw er
+
rmdirSync(p, options, er)
}
}
@@ -339,5 +340,24 @@ function rmkidsSync (p, options) {
options.readdirSync(p).forEach(function (f) {
rimrafSync(path.join(p, f), options)
})
- options.rmdirSync(p, options)
+
+ // We only end up here once we got ENOTEMPTY at least once, and
+ // at this point, we are guaranteed to have removed all the kids.
+ // So, we know that it won't be ENOENT or ENOTDIR or anything else.
+ // try really hard to delete stuff on windows, because it has a
+ // PROFOUNDLY annoying habit of not closing handles promptly when
+ // files are deleted, resulting in spurious ENOTEMPTY errors.
+ var retries = isWindows ? 100 : 1
+ var i = 0
+ do {
+ var threw = true
+ try {
+ var ret = options.rmdirSync(p, options)
+ threw = false
+ return ret
+ } finally {
+ if (++i < retries && threw)
+ continue
+ }
+ } while (true)
}