Skip to content

bad event on bad file using mode watch #156

@feeloo007

Description

@feeloo007

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions