Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Ctrl-C causes crash
@ 2008-11-19 20:52 Steve Goldman
  2008-11-20 14:28 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Goldman @ 2008-11-19 20:52 UTC (permalink / raw)



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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [sup-talk] Ctrl-C causes crash
  2008-11-19 20:52 [sup-talk] Ctrl-C causes crash Steve Goldman
@ 2008-11-20 14:28 ` William Morgan
  0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2008-11-20 14:28 UTC (permalink / raw)


Reformatted excerpts from Steve Goldman's message of 2008-11-19:
> 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.

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.)

> /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?

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>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-20 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-19 20:52 [sup-talk] Ctrl-C causes crash Steve Goldman
2008-11-20 14:28 ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox