Permalink
Browse files

Replace check for existence of file before initializing watcher with …

…catching

the error.
  • Loading branch information...
hron committed Jul 1, 2011
1 parent 33c997c commit 4fe776f5e1cb0225f2afb0b4635847ac0f92a4f9
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/rb-inotify/notifier.rb
@@ -190,7 +190,10 @@ def watch(path, *flags, &callback)
return watch(path, *((flags - [:recursive]) | rec_flags)) do |event|
callback.call(event) if flags.include?(:all_events) || !(flags & event.flags).empty?
next if (rec_flags & event.flags).empty? || !event.flags.include?(:isdir)
- watch(event.absolute_name, *flags, &callback) if File.exists?(event.absolute_name)
+ begin
+ watch(event.absolute_name, *flags, &callback)
+ rescue Errno::ENOENT
+ end
end
end

0 comments on commit 4fe776f

Please sign in to comment.