[Pkg-javascript-commits] [node-rimraf] 01/05: New upstream version 2.6.2

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Nov 9 11:15:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-rimraf.

commit f7802223136c06d551848be34cfb60911a189782
Author: Pirate Praveen <praveen at debian.org>
Date:   Thu Nov 9 16:26:07 2017 +0530

    New upstream version 2.6.2
---
 bin.js       | 16 +++++++++++++---
 package.json |  4 ++--
 rimraf.js    | 29 +++++++++++++++++++++++++----
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/bin.js b/bin.js
index 1bd5a0d..0d1e17b 100755
--- a/bin.js
+++ b/bin.js
@@ -4,16 +4,21 @@ var rimraf = require('./')
 
 var help = false
 var dashdash = false
+var noglob = false
 var args = process.argv.slice(2).filter(function(arg) {
   if (dashdash)
     return !!arg
   else if (arg === '--')
     dashdash = true
+  else if (arg === '--no-glob' || arg === '-G')
+    noglob = true
+  else if (arg === '--glob' || arg === '-g')
+    noglob = false
   else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
     help = true
   else
     return !!arg
-});
+})
 
 if (help || args.length === 0) {
   // If they didn't ask for help, then this is not a "success"
@@ -24,7 +29,9 @@ if (help || args.length === 0) {
   log('')
   log('Options:')
   log('')
-  log('  -h, --help    Display this usage info')
+  log('  -h, --help     Display this usage info')
+  log('  -G, --no-glob  Do not expand glob patterns in arguments')
+  log('  -g, --glob     Expand glob patterns in arguments (default)')
   process.exit(help ? 0 : 1)
 } else
   go(0)
@@ -32,7 +39,10 @@ if (help || args.length === 0) {
 function go (n) {
   if (n >= args.length)
     return
-  rimraf(args[n], function (er) {
+  var options = {}
+  if (noglob)
+    options = { glob: false }
+  rimraf(args[n], options, function (er) {
     if (er)
       throw er
     go(n+1)
diff --git a/package.json b/package.json
index c2cc045..28aed65 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "rimraf",
-  "version": "2.5.4",
+  "version": "2.6.2",
   "main": "rimraf.js",
   "description": "A deep deletion module for node (like `rm -rf`)",
   "author": "Isaac Z. Schlueter <i at izs.me> (http://blog.izs.me/)",
@@ -21,6 +21,6 @@
   ],
   "devDependencies": {
     "mkdirp": "^0.5.1",
-    "tap": "^6.1.1"
+    "tap": "^10.1.2"
   }
 }
diff --git a/rimraf.js b/rimraf.js
index 5d9a576..e80dd10 100644
--- a/rimraf.js
+++ b/rimraf.js
@@ -5,6 +5,7 @@ var assert = require("assert")
 var path = require("path")
 var fs = require("fs")
 var glob = require("glob")
+var _0666 = parseInt('666', 8)
 
 var defaultGlobOpts = {
   nosort: true,
@@ -85,7 +86,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
@@ -165,7 +166,7 @@ function fixWinEPERM (p, options, er, cb) {
   if (er)
     assert(er instanceof Error)
 
-  options.chmod(p, 666, function (er2) {
+  options.chmod(p, _0666, function (er2) {
     if (er2)
       cb(er2.code === "ENOENT" ? null : er)
     else
@@ -187,7 +188,7 @@ function fixWinEPERMSync (p, options, er) {
     assert(er instanceof Error)
 
   try {
-    options.chmodSync(p, 666)
+    options.chmodSync(p, _0666)
   } catch (er2) {
     if (er2.code === "ENOENT")
       return
@@ -310,6 +311,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 +341,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)
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-rimraf.git



More information about the Pkg-javascript-commits mailing list