Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotfile search with ignore filtering out all responses, never emits 'end' #232

Closed
thirdcreed opened this issue Nov 22, 2015 · 3 comments
Closed

Comments

@thirdcreed
Copy link

require("glob").Glob("**/home/thirdcreed/Projects/glob-stream/test/fixtures/*swag**", {
  ignore: [
    "/home/thirdcreed/Projects/glob-stream/test/fixtures/**"
  ],
  dot:true,
  cwd: "/home/thirdcreed/Projects/glob-stream/test",
  cwdbase:false,
  nonull:false
}).on("end",function(x){
  console.log("end stream emitted",x);
})

emits nothing...I can trace it all the way to inside the _finish block of node_glob's glob.js, and I console.log it on both sides of the emit, it logs on both sides of the emit, but it never seems to fire.

BUT

require("glob").Glob("**/home/thirdcreed/Projects/glob-stream/test/fixtures/*swag**", {
  ignore:[
    "**/home/thirdcreed/Projects/glob-stream/test/DOESNOTCOVER/**"
  ],
  dot:true,
  cwd: "/home/thirdcreed/Projects/glob-stream/test",
  cwdbase:false,
  nonull:false
}).on("end",function(x){
  console.log("end stream emitted",x);
})

emits with no problems.

The first one has an ignore that filters all files out.

The second has an ignore that doesn't filter at all.

@thirdcreed thirdcreed changed the title Dotfile search with ignore filtering out all responses, never emits end' Dotfile search with ignore filtering out all responses, never emits 'end' Nov 22, 2015
@thirdcreed
Copy link
Author

Then somehow this emits

require("glob").Glob("**/home/thirdcreed/Projects/glob-stream/test/fixtures/*swag**", {
  ignore:[
    "**/home/thirdcreed/Projects/glob-stream/test/fixtures/*swag**"
  ],
  dot:true,
  cwd: "/home/thirdcreed/Projects/glob-stream/test",
  cwdbase:false,
  nonull:false
}).on("end",function(x){
  console.log("end stream emitted",x);
})

Any insight from anyone would be much appreciated, this is really confusing me.

@thirdcreed
Copy link
Author

It's a race condition. The glob object isn't instantiated when the event is emitted. The event isn't registered because there's no listeners attached.

@isaacs isaacs closed this as completed in 4c79d1e Mar 5, 2016
@isaacs
Copy link
Owner

isaacs commented Mar 5, 2016

Indeed! Fixed on 7.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants