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

Gaze callback function runs multiple times on Windows 8.1 #172

Open
iMoses opened this issue Dec 26, 2014 · 4 comments
Open

Gaze callback function runs multiple times on Windows 8.1 #172

iMoses opened this issue Dec 26, 2014 · 4 comments

Comments

@iMoses
Copy link

iMoses commented Dec 26, 2014

Code:

var gaze = require('gaze');
console.log('script loaded');
gaze(__dirname + '/../public/assets/javascripts/**/*', {maxListeners: 999}, function(err, watcher) {
    console.log('gaze function called');
    this.on('all', function(event, filepath) {
        console.log(filepath + ' was ' + event);
    });
});

On Ubuntu terminal:

script loaded
gaze function called

On Windows 8.1 PowerShell:

script loaded
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called
gaze function called

He's also not actually watching the files when I run this code on windows, I have a feeling that it might be connected to this strange output. I'm guessing this ain't normal.
Any ideas? Any extra information I can provide you?

I'm using Node v0.10.34

@shama
Copy link
Owner

shama commented Dec 26, 2014

Try this instead:

gaze('**/*', {
  cwd: __dirname + '/../public/assets/javascripts/',
  maxListeners: 999
}, function(err, watcher) {
// ...

It works based on patterns, so when using absolute paths it is better to set the cwd instead.

@iMoses
Copy link
Author

iMoses commented Dec 27, 2014

Code:

var gaze = require('gaze');
console.log('script loaded');
gaze('**/*', {
    cwd: __dirname + '/../public/assets/javascripts/',
    maxListeners: 999
}, function(err, watcher) {
        console.log('gaze function called');
    this.on('all', function(event, filepath) {
        console.log(filepath + ' was ' + event);
    });
    this.on('ready', function(watcher) {
        console.log('ready');
    });
});

Output:

script loaded
gaze function called
gaze function called
gaze function called
gaze function called
ready
ready
ready
ready
gaze function called

@shama
Copy link
Owner

shama commented Dec 27, 2014

Hmm strange. I can't reproduce on Windows 7 and don't have access to a Win 8.1 machine atm. So, if you can track down the issue on Windows 8.1 that would be super helpful. Thanks!

@docluv
Copy link

docluv commented Mar 18, 2015

I am not using PowerShell, just the command line on Windows 8.1. But I am not seeing this issue. So maybe it was fixed or it is something in PowerShell.

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

3 participants