summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-06-07 10:14:17 +0200
committerLudovic Courtès <ludo@gnu.org>2023-06-08 22:06:00 +0200
commit92ee0fd5eb7b1572cd4f90a7c12c1137ce74004b (patch)
tree03906efaaa143b4ab326e0fdfdf47b951eea7a20
parent872b2487451c39020a78ed3227992fb02a7ed5e5 (diff)
downloadguix-92ee0fd5eb7b1572cd4f90a7c12c1137ce74004b.tar.gz
import: Gracefully handle EPIPE.
Previously, "guix import pypi f3 | head -3" would print a backtrace.

* guix/scripts/import.scm (guix-import): Wrap
'pretty-print-with-comments' call in 'leave-on-EPIPE'.
-rw-r--r--guix/scripts/import.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index f84a964a53..4ddd8d46a1 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -85,7 +85,8 @@ Run IMPORTER with ARGS.\n"))
     ((importer args ...)
      (if (member importer importers)
          (let ((print (lambda (expr)
-                        (pretty-print-with-comments (current-output-port) expr))))
+                        (leave-on-EPIPE
+                         (pretty-print-with-comments (current-output-port) expr)))))
            (match (apply (resolve-importer importer) args)
              ((and expr (or ('package _ ...)
                             ('let _ ...)