Skip to content

Many problems, help appreciated :) #154

Open
@julien-f

Description

@julien-f

Gaze install:

> npm i gaze
> gaze@0.6.4 install /tmp/tmp.0KceyZvfHl/node_modules/gaze
> node-gyp rebuild

make: Entering directory '/tmp/tmp.0KceyZvfHl/node_modules/gaze/build'
  CXX(target) Release/obj.target/pathwatcher/src/main.o
  CXX(target) Release/obj.target/pathwatcher/src/common.o
  CXX(target) Release/obj.target/pathwatcher/src/handle_map.o
../src/handle_map.cc: In member function ‘bool HandleMap::Erase(WatcherHandle)’:
../src/handle_map.cc:41:26: warning: ‘void NanDispose(v8::Persistent<S>&) [with T = v8::Value]’ is deprecated (declared at ../node_modules/nan/nan.h:612) [-Wdeprecated-declarations]
   NanDispose(iter->second); // Deprecated, use NanDisposePersistent when v0.12 lands
                          ^
../src/handle_map.cc: In member function ‘void HandleMap::Clear()’:
../src/handle_map.cc:48:28: warning: ‘void NanDispose(v8::Persistent<S>&) [with T = v8::Value]’ is deprecated (declared at ../node_modules/nan/nan.h:612) [-Wdeprecated-declarations]
     NanDispose(iter->second); // Deprecated, use NanDisposePersistent when v0.12 lands
                            ^
  CXX(target) Release/obj.target/pathwatcher/src/pathwatcher_linux.o
  SOLINK_MODULE(target) Release/obj.target/pathwatcher.node
  SOLINK_MODULE(target) Release/obj.target/pathwatcher.node: Finished
  COPY Release/pathwatcher.node
make: Leaving directory '/tmp/tmp.0KceyZvfHl/node_modules/gaze/build'
gaze@0.6.4 node_modules/gaze
├── bindings@1.2.1
├── absolute-path@0.0.0
├── nextback@0.1.0
├── graceful-fs@2.0.3
├── nan@0.8.0
└── globule@0.2.0 (lodash@2.4.1, minimatch@0.2.14, glob@3.2.11)

Test code:

require('gaze')('/tmp', function (error) {
  if (error) {
    console.error(error);
    return;
  }

  this.watched(function (error, files) {
    if (error) {
      console.log(error);
      return;
    }
    console.log('watched:', files);
  });

  this.on('added', function (file) {
    console.log('added', file);
  });
  this.on('changed', function (file) {
    console.log('changed', file);
  });
  this.on('deleted', function (file) {
    console.log('deleted', file);
  });
  this.on('renamed', function (file) {
    console.log('renamed', file);
  });
});
  1. With this setup, no file creation, deletion, renaming or change in the /tmp directory is picked up.
  2. I suspect it's because I need to use the '/tmp/*' pattern to indicate I want to watch files inside.
    But now, if file change and deletion is correctly detected, addition and renaming still does not work.
  3. Maybe it is because the parent directory should also be watched to detect new files so I set ['/tmp', '/tmp/*'] as the pattern. But I still get the same behavior 😢
  4. I have seen in other issues that you suggest to use the cwd options so now I use '*' for the pattern and '/tmp' as cwd. Now we're getting somwhere! The creation, change and deletion work but still no luck for renaming, I only get a delete event :/
    Another problem is that when I delete all files (rm -f *) only the deletion of the first one is picked up.

What am I doing wrong?

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