diff mbox series

[bug#57850,1/2] marionette: Make it easier to debug REPL read failures.

Message ID 20220916073236.23634-1-mail@cbaines.net
State Accepted
Headers show
Series [bug#57850,1/2] marionette: Make it easier to debug REPL read failures. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Christopher Baines Sept. 16, 2022, 7:32 a.m. UTC
Log the remaining contnet written to the REPL, so that there's more to go on
than:

  socket:5:14: Unknown # object: "#<"

* gnu/build/marionette.scm (marionette-eval): Catch exceptions from read and
log the remainder of the content from the REPL.
---
 gnu/build/marionette.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Mathieu Othacehe Sept. 16, 2022, 8:37 a.m. UTC | #1
Hey Chris,

> Log the remaining contnet written to the REPL, so that there's more to go on
                       ^
                       content

Looks fine!

Mathieu
diff mbox series

Patch

diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 06b699bd7b..fd59a4c72f 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -178,7 +178,18 @@  (define (marionette-eval exp marionette)
     (($ <marionette> command pid monitor (= force repl))
      (write exp repl)
      (newline repl)
-     (read repl))))
+     (with-exception-handler
+         (lambda (exn)
+           (simple-format
+            (current-error-port)
+            "error reading marionette response: ~A
+  remaining response: ~A\n"
+            exn
+            (get-line repl))
+           (raise-exception exn))
+       (lambda ()
+         (read repl))
+       #:unwind? #t))))
 
 (define* (wait-for-file file marionette
                         #:key (timeout 10) (read 'read))