Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the quickest, simplest way to lauch a pre-existing restart?

Ok, I need to rewrite this question.

If I go:

CL-USER> whatever

I get this in the debugger frame:

The variable WHATEVER is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {C0C6CF9}>)
 ...

Therefore, I should be able to do this:

(handler-case
    whatever
  (unbound-variable (e) (invoke-restart 'retry)))

Yet it yields:

No restart RETRY is active.
   [Condition of type SB-INT:SIMPLE-CONTROL-ERROR]
...

What am I missing?

The ABORT retry does work correctly; thanks hans and Svante for pointing that out. The others - retry, terminate-thread, etc - all error out.

I've also tried hitting e in the debugger and running INVOKE-RESTART directly. Same result with one exception: the low-level example in this answer works like I think it should:

Eval in frame (COMMON-LISP-USER)> (invoke-restart 'go-on)

returns to the prompt without complaint. The high-level example will only restart correctly when selected by hand from the restarts menu.

like image 856
BnMcGn Avatar asked Dec 01 '25 08:12

BnMcGn


1 Answers

The star in front of the restart 1 in your output indicates that this restart will be invoked by SLIME's [q]uit command. The name of the restart is 'ABORT, so in order to invoke it, use this:

(handler-case
    whatever
  (unbound-variable (e) (invoke-restart 'abort)))
like image 68
hans23 Avatar answered Dec 07 '25 07:12

hans23



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!