From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Thu, 20 Nov 2008 06:28:26 -0800 Subject: [sup-talk] Ctrl-C causes crash In-Reply-To: <1227127838-sup-7819@sgoldmanlinux.tower-research.com> References: <1227127838-sup-7819@sgoldmanlinux.tower-research.com> Message-ID: <1227191082-sup-3553@entry> 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