I am using sbcl 1.0.57.0 and want to start a program via --eval
which should generate some output, but in case that there is an uncaught error it shall exit.
I figured the easiest way to accomplish that would be by using unwind-protect:
(unwind-protect (error 'simple-error)
(progn (FORMAT t "IAMREACHED~%") (sb-ext:exit)))
As (sb-ext:exit)
should be executet incase there is an uncaught error.
But it doesn't!
* (unwind-protect (error 'simple-error)
(progn (FORMAT t "IAMREACHED~%") (sb-ext:exit)))
debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {1002979193}>:
(A SIMPLE-ERROR was caught when trying to print *DEBUG-CONDITION* when entering
the debugger. Printing was aborted and the SIMPLE-ERROR was stored in
SB-DEBUG::*NESTED-DEBUG-CONDITION*.)
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(#:EVAL-THUNK)
0] 0
IAMREACHED
What is my misconception about the workings of unwind-protect?