-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Make fs.watch recursive actually useful #6655
Comments
I believe that this is how it is now because this mode of operation it isn't supported on other platforms. Also, as far as I remember, FSEvents seems to be mixing flags altogether: Created | Modified | ... . Anyway, how do you imagine this working on linux, smartos? |
recursive |
I'm not really sure, it may add even more diversity. @tjfontaine do you have any thoughts on it? |
Just in case, the use case here is universal file watcher paulmillr/chokidar — i'm already watching stuff via I include it as Any way to access fsevents without GYP would be nice |
I'll assign it to me, but note that it'll have low priority for me, since I have a lot of other important things to do before it. |
It seems the Brackets team were able to get recursive events on Windows: adobe/brackets#6551 "This new node-module replaces Brackets' previous use of node's fs.watch() with a Windows-native implementation of the same ReadDirectoryChangesW() function, but leveraging the 'recursive' flag. So, on Windows, we now only have to set a single watcher at the project root level, rather than having to iterate thru and set individual fs.watch() watchers for each subfolder within the project. As a result, the observed "in-use" issues disappear." |
@indutny The fixing patch is adobe/brackets#6686. Think we could take advantage of that code? |
cc @saghul |
@indutny @trevnorris ... was there ever any resolution on this one? |
@jasnell I don't think there was any resolution. They'd mention it in changelog. The way to do this now is to stick to 3rd party file watchers — chokidar etc. |
@jasnell There is actually a pull request which has been waiting in libuv to add full recursive support to Windows. It needs a few tweaks and review. It would be great if this could be finished. Recursive support is especially needed on Windows as the watch locks the watched directory (i.e. it's not possible to setup a tree of watches). With recursive support on Mac and Windows, it will finally be possible to build a much better third party watch module (using a tree of watches for Linux + increasing the system watch limit). Most of the modules currently rely on scanning and this requires keeping the whole watched tree in memory. |
Ok, going to mark this as a defer to the converged repo, then. Will keep this open, however. |
Thanks. |
0.11 adds support for recursive fs watcing with fsevents.
This is great, except that even with the change
fs.watch
is useless crap as it was before. There are just two events that are triggered randomly:change
andrename
(even for deletion / creation)Can we make it more useful at least when it's in fsevents mode?
FSEvents callback should return
flags
(FSEventStreamEventFlags
) property. Flags are super useful — we can tell all sorts of things by them. Whether it was created, modified, deleted, whether it was a file or dir or a symlink, whether it was renamed or its finder attr was changed. Like this:So, tl;dr: Introduce
flags
integer argument that is returned when watching throughfs.watch
The text was updated successfully, but these errors were encountered: