summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-03-13 11:56:52 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-13 22:51:18 +0100
commit2569bd994bab4f057ac5aa6755fdee76b1c816de (patch)
treeb8bdba16047559d53458bbe5e908221d2ae6de91
parentfaf271e96e0a9c129790d141858e1b7ab1cadff4 (diff)
downloadguix-2569bd994bab4f057ac5aa6755fdee76b1c816de.tar.gz
inferior: Add <inferior> printer.
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!'.
-rw-r--r--guix/inferior.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm
index f977f8386e..eb457f81f9 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -120,6 +120,15 @@
   (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