Closed mkasztelnik closed 10 years ago
I'm not entirely sure what the issue you're seeing in. Your examples are confusing; the second one is listening to a lot more event types than the first. In addition, I'd expect some directory modification events to work differently to some extent than file modificiation events, since you're coming at them from a different perspective.
Ultimately, rb-inotify
just pipes events from the underlying inotify system, so which events exist or not is rarely up to the Ruby code. If you still think we're reporting events incorrectly, though, please mention:
I'm saving the same file in both cases (/home/marek/git/rails/air/spec/models/appliance_spec.rb
). When I'm listening on this file attrib
event is generated. When I'm listening on the directory in which my file is located attrib
event is not generated.
Additional events are not important in this case. So the code presented above can be modified into:
require 'rb-inotify'
EVENTS = [:recursive, :attrib]
notifier = INotify::Notifier.new
notifier.watch('/home/marek/git/rails/air/spec/models/', *EVENTS) do |event|
puts "#{event.flags} is now in #{event.absolute_name}!"
end
notifier.run
Than no attrib
event is generated for saved file in in SublimeText3
, instead following events are generated:
[:attrib] is now in /home/marek/git/rails/air/spec/models/.subl543.tmp!
[:attrib] is now in /home/marek/git/rails/air/spec/models/.subl543.tmp!
[:attrib] is now in /home/marek/git/rails/air/spec/models/.subl543.tmp!
For saving in vim this event is generated.
If rb-notify
is not source of the problem than what do you think it can be: SublimeText3
, inotify
?
@nex3 after applying https://github.com/guard/listen/issues/155#issuecomment-30109711 into SublimeText3
everything works as expected :)
This is a issue discovered and discussed in this thread: https://github.com/guard/listen/issues/155
I'm using kubuntu 13.10 and SublimeText3 (build 3056 but the same issue occurs in previous builds). It seems like
rb-inotify
generates different events when listening file and directory. Following code:generates:
while saving file using Sublimetext3. But following code:
generates: