-
Notifications
You must be signed in to change notification settings - Fork 10
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
FYI: issue with Vim and fsevents_to_vm on file events #7
Comments
This is a consequence of how fsevents_to_vm works -- it doesn't actually modify the file, just the file's metadata attributes (specifically the mtime). This shows up as an inotify ATTRIB event on the directory. This hasn't been a problem in practice because all the use cases we've cared about (guard, webpack, etc) react to these events. Are you seeing a specific problem, or were you just investigating how it worked? |
Yes, I was bit by this when passing individual files to watchify. |
In theory we could use the same de-duping logic that we have for mtime changes, but actually open up the file. I wonder if a zero-length write would trigger an event. It'd take some testing to see what we can get away with. |
I've had the same issue with live reloading in Phoenix. I've tracked the issue down to this line It looks like they don't watch for ATTRIB at all. |
Good info thanks. They watch for So in theory, we could open the file for writing, then immediately close it without writing anything, and it should work with Phoenix and probably most others who don't watch for attrib changes. It'll be a while before I have time to work on this, though. |
Yeah, I just tested it with |
I've got a WIP branch that simulates WRITE_CLOSE events, which appears to be enough to fix this issue. However, it doesn't look like that's good enough for the inotify.go library (and thus CompileDaemon), which doesn't watch for WRITE_CLOSE and requires an actual MODIFY event. The only way to get a modify event is to actually modify the file in the docker VM, which is of course a lot more problematic... I'll have to think about it for a while. I'm not sure what the solution could be yet. |
Steps to replicate
Expected behavior
inotifywait reports the file has changed
Observed behavior
inotifywait does not report anything
Fix for Vim is to add
set backupcopy=yes
to .vimrc .Note that inotifywait on the directory containing foo.js does report an event.
Could this behavior be due to the limitation to fsevents_to_vm that
Multiple events for the same file within the same 1/100th of a second may cause events to be missed.
?[0] I'm using the vim binary provided by MacVim, in my terminal.
The text was updated successfully, but these errors were encountered: