From: Teemu Likonen on
I'm trying to write a user-friendly handler for Ctrl-C interrupt in SBCL
programs. So far I've been unsuccessful. The default long backtrace is
not something I'd like to have in my programs.

I expected this to work:

(defun main ()
"The main program."
...)

(handler-case (main)
(sb-sys:interactive-interrupt ()
(format t "I'm your friendly interrupt handler.~%")
(sb-ext:quit)))

But it doesn't. I can suppress the ugly backtrace and other error
messages with

(with-output-to-string (*error-output*)
(main))

(which I'm doing now) but how about a custom handler? I can't figure out
how to do it. Thanks for any help.
From: nikodemus on
On Mar 14, 2:11 pm, Teemu Likonen <tliko...(a)iki.fi> wrote:

> I'm trying to write a user-friendly handler for Ctrl-C interrupt inSBCL
> programs. So far I've been unsuccessful. The default long backtrace is
> not something I'd like to have in my programs.
>
> I expected this to work:
>
>     (defun main ()
>       "The main program."
>       ...)
>
>     (handler-case (main)
>       (sb-sys:interactive-interrupt ()
>         (format t "I'm your friendly interrupt handler.~%")
>         (sb-ext:quit)))
>
> But it doesn't.

That's a bug. SIGINT-HANDLER failed to actually signal the condition
before forcing entry to debugger -- oops.

Fixed in SBCL 1.0.36.29.

Cheers,

-- Nikodemus Siivola

[ For future reference, I saw this by chance alone: comp.lang.lisp is
not the best channel for SBCL questions and issue reports -- SBCL
mailing lists and the bug trackers are generally more reliable ways of
getting help. ]