Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: sgoldman@tower-research.com (Steve Goldman)
Subject: [sup-talk] [PATCH] make ctrl-c prompt user if sup should die ungracefully
Date: Sun, 23 Nov 2008 14:29:36 -0500	[thread overview]
Message-ID: <1227468533-sup-3252@sgoldmanlinux.tower-research.com> (raw)

---
 bin/sup |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bin/sup b/bin/sup
index 124af75..cee7051 100644
--- a/bin/sup
+++ b/bin/sup
@@ -181,7 +181,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
 
@@ -195,7 +204,6 @@ begin
       rescue InputSequenceAborted
         :nothing
       end
-
     case action
     when :quit_now
       break if bm.kill_all_buffers_safely
-- 
1.5.6.4
-- 

Steve Goldman
sgoldman at tower-research.com

T: 212.219.6014
F: 212.219.6007

Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013


             reply	other threads:[~2008-11-23 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-23 19:29 Steve Goldman [this message]
2008-11-27  0:23 ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227468533-sup-3252@sgoldmanlinux.tower-research.com \
    --to=sgoldman@tower-research.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox