-
Notifications
You must be signed in to change notification settings - Fork 2k
Using fs.watchFile if supported, fs.watch otherwise (fixes #1803) #1846
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
Conversation
|
Does this work with high frequency file changes (greater than 1 per second)? |
|
@michaelficarra Why wouldn't it? On any system where @jashkenas Actually, it looks like we may be able to salvage |
|
Is the file being renamed? |
|
New pull request is at #1847. However, let me make one modification before merging... |
|
@TrevorBurnham: I was referring to the |
|
@michaelficarra Ah, yeah, I ran some tests on that yesterday while I was IRC-ing with jashkenas. If you do rapid changes (say, 10 of them with a 100ms delay between each), only a few of the changes are detected—but the last one always is, which is the important thing. (Obviously the polling approach used by |
|
Ah, okay, as long as the last change is always detected like it was before. |
|
Reopening this pull request in response to #1853. |
|
So the
@jashkenas, I really think we should merge this pull in (using Meanwhile, I'm working on a module that'll let us get the right behaviors out of |
|
More bad news for It's likely to take a while for the Node team to clean all this up. |
|
Shall we just revert to the previous |
|
Yes. edit: I was a little quick with my run-away-from- |
|
I'd much rather do a 1.1.4 release based on this patch, with fs.watch as a fallback. Then everyone's happy, including Windows users and potentially people in a future where fs.watchFile is gone. Then we do a full-on transition to fs.watch in 1.2, after the Node team has worked the kinks out. On Nov 14, 2011, at 1:20 PM, Jeremy [email protected] wrote:
|
|
I'd rather not half-ass it. If it's unusably buggy, then it's unusably buggy ... if it's good enough, then it's good enough for all of us. It sounds like the former is the case. |
|
Well, it's certainly more usable than fs.watchFile under Windows. Is it really a "half-ass" solution if it produces the best possible behavior on all platforms? On Nov 14, 2011, at 1:27 PM, Jeremy [email protected] wrote:
|
|
I tested this build on mac os lion, this works for me: https://github.com/TrevorBurnham/coffee-script/tree/issue_1803 |
|
Mathhew: Yes, but you'll hit errors in various edge cases; see my links to the Node issue tracker above. On Nov 14, 2011, at 1:44 PM, Matthew [email protected] wrote:
|
|
What's against just being pragmatic/conservative with tools and other code that is not central to the project? Ever since 1.1.3 I can no longer watch for changes (and no I'm not running Windows), while it used to work just fine. I'd say wait with using |
This isn't elegant, but at least it doesn't do platform-sniffing. Instead, it:
fs.watchFileunder Node 0.4.x),fs.watchFileis removed in a future release), andfs.watchFileon non-Windows systems (see discussion at #1803)I've tested that it works on the Mac (detecting saves from Coda and everything); someone else will have to give it a whirl under Windows.