]> git.cworth.org Git - sup/commitdiff
die gracefully upon SIGKILL
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Fri, 7 Aug 2009 00:25:41 +0000 (20:25 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Fri, 7 Aug 2009 00:25:41 +0000 (20:25 -0400)
bin/sup
lib/sup/suicide.rb

diff --git a/bin/sup b/bin/sup
index 2d5de6733fcdf76f1a58caa3d64aadce0c02c143..b87c11223342aefe977b34e99f053ba548a4fc6d 100755 (executable)
--- a/bin/sup
+++ b/bin/sup
@@ -160,7 +160,7 @@ begin
   Redwood::start
   Index.load
 
-  trap("TERM") { |x| raise "so speaking as i think, i die, i die!" }
+  trap("TERM") { |x| SuicideManager.please_die! }
   trap("WINCH") { |x| BufferManager.sigwinch_happened! }
 
   if(s = Redwood::SourceManager.source_for DraftManager.source_name)
index 98b43462eea250aa6969221d0a8456b9697bd54a..53f31a5e25a7f8699bf0ea23e26e9906976f0101 100644 (file)
@@ -14,6 +14,7 @@ class SuicideManager
   end
 
   bool_reader :die
+  def please_die!; @die = true end
 
   def start
     @thread = Redwood::reporting_thread("suicide watch") do