-
Notifications
You must be signed in to change notification settings - Fork 118
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
Track files replaced by move #10
Conversation
Can one of the admins verify this patch? |
Alternative approach: run the build, then drop and re-add all watches. This usually gives enough time for the file to re-appear. |
ibazel/main.go
Outdated
@@ -59,6 +59,25 @@ ibazel build //path/to/my/buildable:target | |||
`) | |||
} | |||
|
|||
type SourceEventProcessor struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this into its own file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ibazel/main.go
Outdated
SourceFileWatcher *fsnotify.Watcher | ||
} | ||
|
||
func (s SourceEventProcessor) Listen() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a method that creates a SourceEventProcessor and creates the channel then calls
go s.Listen()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ibazel/main.go
Outdated
@@ -107,7 +132,7 @@ func main() { | |||
switch state { | |||
case WAIT: | |||
select { | |||
case <-sourceFileWatcher.Events: | |||
case <-sourceFileEvents: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you refer to the channel as being attached to the object instead of in the function scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your submission!
This test reproduces the write behavior of vim with `backupcopy` set to both `yes` and `no`. `yes` is the default on Linux, and bazelbuild#10 fixed this case. Unforunately, on macOS, `yes` is not the default, and using `no` will cause ibazel to stop watching the file after a single file save when a kqueue-based file watcher is used.
This test reproduces the write behavior of vim with `backupcopy` set to both `yes` and `no`. `yes` is the default on Linux, and bazelbuild#10 fixed this case. Unforunately, on macOS, `yes` is not the default, and using `no` will cause ibazel to stop watching the file after a single file save when a kqueue-based file watcher is used.
* Add test reproducing vim backupcopy=no and kqueue failure This test reproduces the write behavior of vim with `backupcopy` set to both `yes` and `no`. `yes` is the default on Linux, and #10 fixed this case. Unforunately, on macOS, `yes` is not the default, and using `no` will cause ibazel to stop watching the file after a single file save when a kqueue-based file watcher is used. * Readd files when they are moved to overcome limitations in kqueue.
Adds a watch back to any file that has been replaced by a move. We look for a fsnotify.Remove event and retry watcher.Add() until it returns an error code of 0. Once a max number of retries has been exceeded, it is assumed that the file was removed.
Fixes: #9