-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
In the fs.watch
callback, event
parameter is always "rename" on OS X
#7420
Comments
Appending to a file will log
While that runs, in another terminal window and in the same directory:
The Per the docs as of this writing, |
@lance I suspect that if we prefer In theory, I'd be OK with that. In practice, it would be a The original comment was written by @bnoordhuis so let's see if he has any further insight. Like, maybe there's been a change to libuv that allows us to handle the events more precisely somehow or something like that. |
It's possible now to check if a handle is closed or closing so the 'drop one event' logic could be revisited. Whether that's a good change, I'll let you decide but adding a |
@Trott I see your point. And I can understand how 'create' file operations are a Given that, I don't see what benefit would be gained by checking if the handle is closed and conditionally emitting both events. Since even by doing all of that, there's no clear way to discern one type of file operation from the other. This is all speculation, of course, since I don't really know libuv. |
I have spent some time using For example, assuming you are a watching a directory, then within a 200 millisecond window, you might receive 10 events for You might find that Perhaps that won't fit your use-case but I hope it helps. |
I've labeled this as Closing for now. @Trott @bnoordhuis or others, please feel free to reopen if you think it makes sense. |
Platform: OSX 10.11.4 @Drenmi I got the same question.I've tried the following actions, and the event name is always rename.
|
@chyingp Appending to a file will fire an event of type |
@chyingp: According to @jorangreef's reply, this is likely a higher level abstraction that should go in a separate library. (I haven't yet checked if one exists.) |
@Trott I tried the following two ways of modifying a file, and got different feedback. It was quite confusing. :(
|
Also using |
I am interested in knowing more about the title of the issue, does this mean that in other operating systems the events are different? I thought it was unified for all operating systems 🤔 |
No, that's |
No matter what manipulation of the file is made, the callback parameter
event
is set to "rename":The text was updated successfully, but these errors were encountered: