Closed hron closed 13 years ago
Yes, you are right. I've replaced check of existence with catching the exception Errno::ENOENT. It works good for me!
Thank you for review and fast answer. I hope this change will eventually in master branch. ;)
Your fix doesn't work, if press ctrl+. It give error after testing in rspec:
/usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/watcher.rb:80:in initialize': No such file or directory - Failed to watch "/root/sport/tmp/cache/configuration_AppConfiguration20110707-16431-vc2zkq-0.lock" (Errno::ENOENT) from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:182:in
new'
from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:182:in watch' from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:190:in
watch'
from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:193:in watch' from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/watcher.rb:41:in
[]'
from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/watcher.rb:41:in callback!' from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/event.rb:128:in
callback!'
from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:220:in process' from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:220:in
each'
from /usr/local/lib/ruby/gems/1.8/gems/rb-inotify-0.8.5/lib/rb-inotify/notifier.rb:220:in process' from /usr/local/lib/ruby/gems/1.8/gems/guard-0.5.0/lib/guard/listeners/linux.rb:66:in
watch_change'
from /usr/local/lib/ruby/gems/1.8/gems/guard-0.5.0/lib/guard/listeners/linux.rb:16:in start' from /usr/local/lib/ruby/gems/1.8/gems/guard-0.5.0/lib/guard.rb:40:in
start'
from /usr/local/lib/ruby/gems/1.8/gems/guard-0.5.0/lib/guard/cli.rb:15:in start' from /usr/local/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in
send'
from /usr/local/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in run' from /usr/local/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
invoke_task'
from /usr/local/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor.rb:263:in dispatch' from /usr/local/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:in
start'
from /usr/local/lib/ruby/gems/1.8/gems/guard-0.5.0/bin/guard:6
from /usr/local/bin/guard:19:in `load'
from /usr/local/bin/guard:19
What about black list for guard, if set folder "temp" there is issue doesn't come
As I can see from backtrace you provided you did not install my fix. You use rb-inotify 0.8.5 gem.
My fix is not yet included in master branch. You have to build gem yourself or add git-based record in your Gemfile to test it.
group :test do
gem 'rb-inotify', :git => 'git://github.com/hron/rb-inotify.git', :branch => 'fix-guard-crash-when-file-is-deleted-very-fast'
end
Do not forget to use 'bundle exec' to run guard:
bundle exec guard
Yes, I use that branch, but run from command "guard". You advise about 'bundle exec guard' helps, thanks. But why it falls when running from command "guard"?
When you run "guard" the running process has access to all installed gems. When you run "bundle exec guard" bundler prepares environment where the running process has access to only gems defined in Gemfile.
This patch works well for me. @nex3, would you please merge it?
rb-inotify crashes when is used by Guard and some file is created and then is deleted very fast at the top of watching directory.
My changes is related to the same problem as issue #10. The fix that was applied to close that issue helps a lot, but I still experience problems when some program creates and then deletes lock file in the top of watched dir.
I am not 100% sure about the change I expose, but it works for me. Could you please review it and says if that make sense? If so, consider to apply it on master.
Thank you in advance!