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

bad event on bad file using mode watch #156

Open
feeloo007 opened this issue Nov 10, 2014 · 1 comment
Open

bad event on bad file using mode watch #156

feeloo007 opened this issue Nov 10, 2014 · 1 comment

Comments

@feeloo007
Copy link

Hello,

excuse me for my bad English.

I think there is an issue in watch mode using "RedHat ES 6.1" (I have not tested later) and node v0.10.29 (incuded with meteor.js 1.0)

My goal is to monitor a single file in a directory containing other files.

In watch mode, the modification of any file in the same directory gaze leads to generate added events on the monitored file.

The problem can be reproduced as follows :

mkdir /var/tmp/20141110/
touch /var/tmp/20141110/{virtual_map.json,virtual_map.20141110_1.json,virtual_map.20141108_1.json}
Gaze = require( 'gaze' ).Gaze

var gaze = new Gaze(
  'virtual_map.json'
  ,
  {
    cwd:
      '/var/tmp/20141110/'
    ,
    mode:
      'watch'
  }
)

gaze.on(
  'error'
  ,
  function( error ) {
    console.log( 'gaze.on error', error )
  }
)

gaze.on(
  'nomatch'
  ,
  function() {

    console.log( "gaze.on nomatch" )
    setTimeout(
      function() {
        gaze.add(
          'virtual_map.json'
        )
      }
      ,
      5000
    )
  }
)


gaze.on(
  'ready'
  ,
  function( watcher ) {
    console.log( "gaze.on ready" )

    watcher.watched(
      function( err, watched ) {
        console.log( err, watched )
      }
    )
  }
)


gaze.on(
  'changed'
  ,
  function( filepath ) {
    console.log( "gaze.on changed", filepath )
    gaze.watched(
      function( err, watched ) {
        console.log( "gaze.on changed", watched )
      }
    )
  }
)

gaze.on(
  'deleted'
  ,
  function( filepath ) {
    console.log( "gaze.on deleted", filepath )
    gaze.watched(
      function( err, watched ) {
        console.log( "gaze.on deleted", watched )
      }
    )
  }
)

gaze.on(
  'added'
  ,
  function( filepath ) {
    console.log( "gaze.on added", filepath )
    gaze.watched(
      function( err, watched ) {
        console.log( "gaze.on added", watched )
      }
    )
  }
)
touch /var/tmp/20141110/virtual_map.20141110_1.json

emits event "added" on file virtual_map.json. bad event on bad filename.

Using mode pool, no events are emitted which is correct. virtual_map.20141110_1.json filename does not comply with the desired pattern.

Thanks for your help

@Kreozot
Copy link

Kreozot commented Dec 8, 2015

Had this issue on Windows.
It has a really strange behavior: when I watch for '*.js' everything is normal. But if I watch for '*.json' - it watches everything like described in this issue.

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