about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-01-02 10:19:20 +0000
committerEric Wong <e@80x24.org>2019-01-02 10:20:01 +0000
commit1df52e7304196386a6a84032aec1e8db3e0b83dd (patch)
tree2c8077f208de1a203e79dcb60fa6c035a634eccb
parent4e51843e9491e97a6473b293812ceb2b2e7acf0f (diff)
Sometimes files become unreadable.
-rw-r--r--lib/dtas/watchable.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/dtas/watchable.rb b/lib/dtas/watchable.rb
index acaf0d5..7d2bac4 100644
--- a/lib/dtas/watchable.rb
+++ b/lib/dtas/watchable.rb
@@ -37,9 +37,13 @@ module DTAS::Watchable # :nodoc:
       @dir2wd = {}
       Array(paths).each do |path|
         watchdir, watchbase = File.split(File.expand_path(path))
-        wd = @dir2wd[watchdir] ||= add_watch(watchdir, FLAGS)
-        m = @watches[wd] ||= {}
-        m[watchbase] = true
+        begin
+          wd = @dir2wd[watchdir] ||= add_watch(watchdir, FLAGS)
+          m = @watches[wd] ||= {}
+          m[watchbase] = true
+        rescue SystemCallError => e
+          warn "#{watchdir.dump}: #{e.message} (#{e.class})"
+        end
       end
     end
   end