diff options
-rw-r--r-- | guix/repl.scm | 8 | ||||
-rw-r--r-- | tests/inferior.scm | 12 |
2 files changed, 19 insertions, 1 deletions
diff --git a/guix/repl.scm b/guix/repl.scm index 0ace5976cf..94d85815ef 100644 --- a/guix/repl.scm +++ b/guix/repl.scm @@ -78,8 +78,14 @@ output port. VERSION is the client's protocol version we are targeting." (let ((stack (if (repl-prompt) (make-stack #t handle-exception (repl-prompt)) (make-stack #t)))) + ;; Note: 'make-stack' returns #f if there's no 'handle-exception' + ;; stack frame, which is the case when this file is being + ;; interpreted as with 'primitive-load'. `(exception (arguments ,key ,@(map value->sexp args)) - (stack ,@(map frame->sexp (stack->frames stack)))))) + (stack ,@(map frame->sexp + (if stack + (stack->frames stack) + '())))))) (_ ;; Protocol (0 0). `(exception ,key ,@(map value->sexp args))))) diff --git a/tests/inferior.scm b/tests/inferior.scm index fb12111343..7c3d730d0c 100644 --- a/tests/inferior.scm +++ b/tests/inferior.scm @@ -75,6 +75,18 @@ (inferior-eval '(throw 'a 'b 'c 'd) inferior) 'badness))) +(test-equal "&inferior-exception, legacy mode" + '(a b c d) + ;; Omit #:command to open an inferior in "legacy" mode, where Guile runs + ;; directly. + (let ((inferior (open-inferior %top-builddir))) + (guard (c ((inferior-exception? c) + (close-inferior inferior) + (and (eq? inferior (inferior-exception-inferior c)) + (inferior-exception-arguments c)))) + (inferior-eval '(throw 'a 'b 'c 'd) inferior) + 'badness))) + (test-equal "inferior-packages" (take (sort (fold-packages (lambda (package lst) (cons (list (package-name package) |