Subject: [sup-talk] Ctrl-C causes crash

From: [email-masked] (Steve Goldman)
Date: Wed, 19 Nov 2008 15:52:17 -0500

This isn't as dumb of a question as it sounds.  Sometimes I'm in a sup
buffer but mistakenly think I'm in emacs.  Then I type Ctrl-X/Ctrl-C
and sup crashes.  This is not cool.  Here is the exception log:

--- Interrupt from thread: main

/apps/home/sgoldman/sup-src/mainline/lib/sup/buffer.rb:31:in `select'
/apps/home/sgoldman/sup-src/mainline/lib/sup/buffer.rb:31:in `nonblocking_getch'
bin/sup:184

I tested just typing Ctrl-C and got the same log output.  Any idea on how to make sup not crash on Ctrl-C?

Thanks.
-- 

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

---

From: [email-masked] (William Morgan)
Date: Thu, 20 Nov 2008 06:28:26 -0800

Reformatted excerpts from Steve Goldman's message of 2008-11-19:
> buffer but mistakenly think I'm in emacs.

The illusion is complete!

> Then I type Ctrl-X/Ctrl-C and sup crashes.  This is not cool.

Ctrl-C is the traditional unix forced-exit mechanism, but perhaps we
could emulate mutt and have it prompt you before quitting. (And in
contrast to regular quit, it shouldn't save state back to the index.)

> make sup not crash on Ctrl-C?

bin/sup already wraps everything in a rescue Exception, so you just need
to check within the rescue block whether it's a ctrl-c exception or not.
Something like:

  rescue Exception => e
    exit 1 if e.is_a?(Interrupt) && BufferManager.ask_yes_or_no("Die now?")
  end
-- 
William <wmorgan-sup at masanjin.net>