aboutsummaryrefslogtreecommitdiff
path: root/guix/repl.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-01-21 00:05:29 +0100
committerLudovic Courtès <ludo@gnu.org>2021-01-21 00:14:38 +0100
commit98d3abe7440717724263cacca8c36e9f43d53fcc (patch)
treee6c17869b7014cfd8ddf83570d772958b2d10abd /guix/repl.scm
parent074a201c33f822a7ab59512e7ee8b301204ff732 (diff)
downloadguix-98d3abe7440717724263cacca8c36e9f43d53fcc.tar
guix-98d3abe7440717724263cacca8c36e9f43d53fcc.tar.gz
repl: Fix exception handling for interpreted code.
The 'stack' variable could be #f when code is interpreted, which in practice happens when running in "legacy" mode--i.e., when 'open-inferior' invokes "guile" instead of "guix repl". * guix/repl.scm (send-repl-response)[handle-exception]: Check whether STACK is true before passing it to 'stack->frames'. * tests/inferior.scm ("&inferior-exception, legacy mode"): New test.
Diffstat (limited to 'guix/repl.scm')
-rw-r--r--guix/repl.scm8
1 files changed, 7 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)))))