inferior: Add <inferior> printer.
authorLudovic Courtès <ludo@gnu.org>
Sat, 13 Mar 2021 10:56:52 +0000 (11:56 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 13 Mar 2021 21:51:18 +0000 (22:51 +0100)
This avoids printing the whole package table in backtraces and such.

* guix/inferior.scm (write-inferior): New procedure.
<top level>: Call 'set-record-type-printer!'.

guix/inferior.scm

index f977f83..eb457f8 100644 (file)
   (packages inferior-package-promise)            ;promise of inferior packages
   (table    inferior-package-table))             ;promise of vhash
 
+(define (write-inferior inferior port)
+  (match inferior
+    (($ <inferior> pid _ _ version)
+     (format port "#<inferior ~a ~a ~a>"
+             pid version
+             (number->string (object-address inferior) 16)))))
+
+(set-record-type-printer! <inferior> write-inferior)
+
 (define* (inferior-pipe directory command error-port)
   "Return an input/output pipe on the Guix instance in DIRECTORY.  This runs
 'DIRECTORY/COMMAND repl' if it exists, or falls back to some other method if