]> git.cworth.org Git - sup/commitdiff
make ctrl-c prompt user if sup should die ungracefully
authorSteve Goldman <sgoldman@tower-research.com>
Sun, 23 Nov 2008 19:29:36 +0000 (14:29 -0500)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 27 Nov 2008 00:15:41 +0000 (16:15 -0800)
bin/sup

diff --git a/bin/sup b/bin/sup
index 152c42c06aa3329a4c51b814d1b03e057bb68e03..b2b2f626d79ff3675d8edbc6bb18bf1a40483ae9 100644 (file)
--- a/bin/sup
+++ b/bin/sup
@@ -194,7 +194,16 @@ begin
   end
 
   until Redwood::exceptions.nonempty? || SuicideManager.die?
-    c = Ncurses.nonblocking_getch
+    c = 
+       begin
+         Ncurses.nonblocking_getch
+       rescue Exception => e
+         if e.is_a?(Interrupt)
+           raise if BufferManager.ask_yes_or_no("Die ungracefully now?")
+           bm.draw_screen
+           nil
+         end
+       end
     next unless c
     bm.erase_flash
 
@@ -208,7 +217,6 @@ begin
       rescue InputSequenceAborted
         :nothing
       end
-
     case action
     when :quit_now
       break if bm.kill_all_buffers_safely