civodul pushed a commit to branch master
in repository guix.
commit 92ee0fd5eb7b1572cd4f90a7c12c1137ce74004b
Author: Ludovic Courtès <[email protected]>
AuthorDate: Wed Jun 7 10:14:17 2023 +0200
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'.
---
guix/scripts/import.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 _ ...)