about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2014-05-14 20:05:55 +0000
committerEric Wong <normalperson@yhbt.net>2014-05-14 20:05:55 +0000
commit262ad7228ad146749d8337a682e8486d38df76c2 (patch)
treec6036a51a4e10da1d6ba9eb28890e4ab4a9a319a
parent4479008d47c846f194e9e50d49f103f27ff8956b (diff)
downloadzbatery-262ad7228ad146749d8337a682e8486d38df76c2.tar.gz
warn about premature grandparent death on daemonization
This may cause failures if some process nukes the grandparent
too soon.
-rw-r--r--lib/zbatery.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/zbatery.rb b/lib/zbatery.rb
index 65c9d0c..a4d20e0 100644
--- a/lib/zbatery.rb
+++ b/lib/zbatery.rb
@@ -92,7 +92,11 @@ module Rainbows
       end
 
       if ready_pipe
-        ready_pipe.syswrite($$.to_s)
+        begin
+          ready_pipe.syswrite($$.to_s)
+        rescue => e
+          logger.warn("grandparent died too soon?: #{e.message} (#{e.class})")
+        end
         ready_pipe.close
         self.ready_pipe = nil
       end