everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
* [PATCH] dtas/watchable: check SystemCallError
@ 2019-01-02 10:42 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-01-02 10:42 UTC (permalink / raw)
  To: dtas-all

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-02 10:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02 10:42 [PATCH] dtas/watchable: check SystemCallError Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).