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:
authorRebecca Turner <me@re-becca.org>2016-03-11 01:10:11 +0300
committerRebecca Turner <me@re-becca.org>2016-03-11 01:38:14 +0300
commitbe55882dc4ee5ce0777b4badc9141dab5bf5be4d (patch)
tree1588da757d901a23b2d2d2231f126f0d84e2a34e /node_modules/glob/glob.js
parent460ed217876ac78d21477c288f1c06563fb770b4 (diff)
glob@7.0.3
Fix a race condition and some windows edge cases. Credit: @isaacs
Diffstat (limited to 'node_modules/glob/glob.js')
-rw-r--r--node_modules/glob/glob.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js
index 804cde53f..4dba04ade 100644
--- a/node_modules/glob/glob.js
+++ b/node_modules/glob/glob.js
@@ -162,14 +162,23 @@ function Glob (pattern, options, cb) {
if (n === 0)
return done()
+ var sync = true
for (var i = 0; i < n; i ++) {
this._process(this.minimatch.set[i], i, false, done)
}
+ sync = false
function done () {
--self._processing
- if (self._processing <= 0)
- self._finish()
+ if (self._processing <= 0) {
+ if (sync) {
+ process.nextTick(function () {
+ self._finish()
+ })
+ } else {
+ self._finish()
+ }
+ }
}
}
@@ -571,10 +580,11 @@ Glob.prototype._readdirError = function (f, er, cb) {
switch (er.code) {
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
case 'ENOTDIR': // totally normal. means it *does* exist.
- this.cache[this._makeAbs(f)] = 'FILE'
- if (f === this.cwd) {
- var error = new Error(er.code + ' invalid cwd ' + f)
- error.path = f
+ var abs = this._makeAbs(f)
+ this.cache[abs] = 'FILE'
+ if (abs === this.cwdAbs) {
+ var error = new Error(er.code + ' invalid cwd ' + this.cwd)
+ error.path = this.cwd
error.code = er.code
this.emit('error', error)
this.abort()