Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Cannot watch junctions on Windows 7 64-bit #285

Open
foxbunny opened this Issue · 6 comments

2 participants

@foxbunny

Starting a python script using the following command:

nodemon -w templates -L tools/static_pages.py

as well as without the -L switch:

nodemon -w templates tools/static_pages.py

In both cases, no changes to any of the files within the templates directory causes nodemon to execute the script again. The script does exits cleanly.

28 Jan 21:13:03 - [nodemon] v1.0.14
28 Jan 21:13:03 - [nodemon] to restart at any time, enter `rs`
28 Jan 21:13:03 - [nodemon] watching: C:\code\monwara\Outernet-home\templates/**/*
28 Jan 21:13:03 - [nodemon] starting `python tools\static_pages.py`
Rendering template home.html
Rendering template subscribe_failure.html
Rendering template subscribe_success.html
28 Jan 21:13:03 - [nodemon] clean exit - waiting for changes before restart

Using the rs command will restart it no problem, too. I've also tried various glob patterns in the watch parameter including ./templates, .\templates, templates/*, etc, but no luck.


--------------
{ run: false,
  system:
   { cwd: 'C:\\code\\monwara\\Outernet-home',
     useFind: false,
     useWatch: false,
     useWatchFile: true },
  required: false,
  dirs: [ 'C:\\code\\monwara\\Outernet-home' ],
  timeout: 1000,
  options:
   { scriptPosition: 0,
     dump: true,
     script: null,
     args: [],
     ignore:
      [ '.git',
        'node_modules/**/node_modules',
        re: /\.git|node_modules/.*.*/node_modules/ ],
     watch: [ '*.*', re: /.*\..*/ ],
     restartable: 'rs',
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     verbose: false,
     stdout: true,
     execOptions:
      { script: null,
        exec: 'node',
        nodeArgs: undefined,
        ext: 'js',
        env: {},
        execArgs: [] },
     ext: 'js',
     monitor:
      [ '*.*',
        '!C:\\code\\monwara\\Outernet-home\\.git/**/*',
        '!node_modules/**/node_modules' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  command: { raw: { executable: 'node', args: [] }, string: 'node' } }
--------------
OS: win32 x64
node: v0.10.5
nodemon: v1.0.14
cwd: C:\code\monwara\Outernet-home
command: node C:\Users\branko\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js --dump
--------------
@remy
Owner

I've got a feeling I can see the problem, but can you re-paste the --dump command, but just append it to what you'd normally run, i.e. nodemon -w templates -L tools/static_pages.py --dump

This way I can see the full config.

@foxbunny

Here is the full dump using nodemon --dump -w templates tools\static_pages.py:

29 Jan 11:22:36 - [nodemon] v1.0.14
29 Jan 11:22:36 - [nodemon] to restart at any time, enter `rs`
29 Jan 11:22:36 - [nodemon] watching: C:\code\monwara\Outernet-home\templates/**/*
--------------
{ run: false,
  system:
   { cwd: 'C:\\code\\monwara\\Outernet-home',
     useFind: false,
     useWatch: false,
     useWatchFile: true },
  required: false,
  dirs: [ 'C:\\code\\monwara\\Outernet-home' ],
  timeout: 1000,
  options:
   { scriptPosition: 0,
     dump: true,
     watch: [ 'templates', re: /templates/ ],
     script: 'tools\\static_pages.py',
     args: [],
     ignore:
      [ '.git',
        'node_modules/**/node_modules',
        re: /\.git|node_modules/.*.*/node_modules/ ],
     restartable: 'rs',
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     verbose: false,
     stdout: true,
     execOptions:
      { script: 'tools\\static_pages.py',
        exec: 'python',
        nodeArgs: undefined,
        ext: 'py',
        env: {},
        execArgs: [] },
     ext: 'py',
     monitor:
      [ 'C:\\code\\monwara\\Outernet-home\\templates/**/*',
        '!C:\\code\\monwara\\Outernet-home\\.git/**/*',
        '!node_modules/**/node_modules' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  command:
   { raw: { executable: 'python', args: [ 'tools\\static_pages.py' ] },
     string: 'python tools\\static_pages.py' } }
--------------
OS: win32 x64
node: v0.10.5
nodemon: v1.0.14
cwd: C:\code\monwara\Outernet-home
command: node C:\Users\branko\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js --dump -w templates tools\static_
ages.py
--------------
@remy
Owner

Perfect. I think it's this line (in config.options.monitor):

'C:\\code\\monwara\\Outernet-home\\templates/**/*'

The slashes are mixed, so I need to check how it's being put together (or at least compared in the matching code). I'll fire up windows and get on this one.

@foxbunny

I think I know what this is about. Here's a snippet from the real project:

5 Feb 10:18:23 - [nodemon] files triggering change check: E:\Dropbox\Monwara\code\everfunder-gae\tests\backend
[ '**\\C:\\code\\monwara\\everfunder-gae\\tests\\backend\\**\\*',
  '!**\\C:\\code\\monwara\\everfunder-gae\\.git\\**\\*',
  '**\\C:\\code\\monwara\\everfunder-gae\\app\\**\\*',
  '!**\\node_modules/**/node_modules' ]
{ result: [], ignored: 1, watched: 0, total: 1 }

I've logged the at line 123 in lib/monitor/match.js to see the list of rules it is applying, and you can see the obvious difference in paths. Thing is, the path I'm watching is in a directory that's a junction (sort of like symlink), and it points to the folder on a different drive. The check is done against the correct target, while the rules are still pointing to the aliased path.

So, I guess a possible fix would be to actually follow symlinks/junctions and determine the correct path before creating rules. To do that, all paths involved should first be checked for links in any of the parent directories, which is, needless to say, complicated by glob patterns etc, which may contain items that are links in the variable parts.

@remy
Owner

I think I follow. So it sounds like the watch rule needs to resolve to a real directory?

The problem that presents is that really a watch rule is a regular string, and not actually a path (though there are some checks that go on in match.js - so possibly the directory could be resolved and the string replaced?).

Are you comfortable testing this on your side if you're already diving into match.js?

@foxbunny

Yeah, sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.