guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: inferior: Add <inferior> printer.


From: guix-commits
Subject: 01/03: inferior: Add <inferior> printer.
Date: Sat, 13 Mar 2021 17:28:53 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 2569bd994bab4f057ac5aa6755fdee76b1c816de
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Mar 13 11:56:52 2021 +0100

    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!'.
---
 guix/inferior.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index f977f83..eb457f8 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]