[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] dtas/watchable: check SystemCallError
From: |
Eric Wong |
Subject: |
[PATCH] dtas/watchable: check SystemCallError |
Date: |
Wed, 2 Jan 2019 10:42:18 +0000 |
Sometimes files become unreadable.
---
lib/dtas/watchable.rb | 10 +++++++---
1 file 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 @@ def watch_files(paths, blk)
@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
--
EW
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] dtas/watchable: check SystemCallError,
Eric Wong <=