Closed krisnye closed 11 years ago
What editor are you using?
Same result with: Notepad, Sublime Text, and even when the files it's watching are js files compiled by coffee -c.
@krisnye: That's odd because it's using polling, not inode (or whatever the NTFS equivalent is) watching. I'm thinking this might be a node bug. Or just lack of Windows support. Can you try watching a file with node's fs.watch
API and see if you can get it to trigger more than once by touching/modifying/overwriting it?
fs.watch specifically or fs.watchFile ok?
I know fs.watchFile works on windows fine, and I use it in my file watcher https://github.com/krisnye/watchdirectory The watch and compile option in coffeescript also works fine.
watchFile current object looks like this on windows:
change { dev: 0,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
ino: 0,
size: 179,
atime: Fri May 10 2013 12:25:21 GMT-0700 (US Mountain Standard Time),
mtime: Fri May 10 2013 13:24:55 GMT-0700 (US Mountain Standard Time),
ctime: Fri May 10 2013 12:25:21 GMT-0700 (US Mountain Standard Time) }
change { dev: 0,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
ino: 0,
size: 179,
atime: Fri May 10 2013 12:25:21 GMT-0700 (US Mountain Standard Time),
mtime: Fri May 10 2013 13:24:59 GMT-0700 (US Mountain Standard Time),
ctime: Fri May 10 2013 12:25:21 GMT-0700 (US Mountain Standard Time) }
curr.ino is always 0, so your unless statement exits early.
instead of
unless curr.ino
console.error "WARNING: watched file #{file} has disappeared"
return
maybe check existence
unless curr.ino?
console.error "WARNING: watched file #{file} has disappeared"
return
I just verified locally that adding the ? to the unless.curr.ino works and fixes the build watching system on windows.
Ah, nice. Want to send over a pull request?
There you go. I should note that I can't build this on windows, so I didn't run any unit tests.
Have you ever built this on windows, and/or do you intend for it to build on windows?
Unfortunately, MS Windows is a non-free OS. So unless somebody is going to buy me a Windows license (assuming it allows for virtualisation), I won't have a Windows machine to test on.
I think I can get you one windows8 x64 pro license. Managed to install it on a vm
This curr.ino problem is related to this bug:
Updated the pull request to be platform specific to 'win32'. Travis CI builds work now.
Repro on Windows 7 with Nodjs 0.10.5:
Create file main.js
run
edit file main.js result:
output.js is also not updated.