summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Tournier <zimon.toutoune@gmail.com>2023-10-12 15:39:03 +0200
committerSimon Tournier <zimon.toutoune@gmail.com>2023-10-17 14:51:53 +0200
commitb4d1eb53c01d3b6e7b255debb593d5c7de725977 (patch)
tree33d6efeea631032eae590e38a1b9d81b52247d82
parent48f9484483a6f5c4a12ac3dc8e8cd1e26df58f9b (diff)
downloadguix-b4d1eb53c01d3b6e7b255debb593d5c7de725977.tar.gz
ui: Handle EPIPE errors when displaying Guix version.
Fixes <https://issues.guix.gnu.org/66254>.
Reported by Clément Lassieur <clement@lassieur.org>.

* guix/ui.scm (show-version-and-exit): Handle EPIPE errors when displaying
version.
-rw-r--r--guix/ui.scm21
1 files changed, 11 insertions, 10 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 6f2d4fe245..e3bf07212f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -552,19 +552,20 @@ See the \"Application Setup\" section in the manual, for more info.\n"))
 
 (define* (show-version-and-exit #:optional (command (car (command-line))))
   "Display version information for COMMAND and `(exit 0)'."
-  (simple-format #t "~a (~a) ~a~%"
-                 command %guix-package-name %guix-version)
-  (format #t "Copyright ~a 2023 ~a"
-          ;; TRANSLATORS: Translate "(C)" to the copyright symbol
-          ;; (C-in-a-circle), if this symbol is available in the user's
-          ;; locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
-          (G_ "(C)")
-          (G_ "the Guix authors\n"))
-  (display (G_"\
+  (leave-on-EPIPE
+   (simple-format #t "~a (~a) ~a~%"
+                  command %guix-package-name %guix-version)
+   (format #t "Copyright ~a 2023 ~a"
+           ;; TRANSLATORS: Translate "(C)" to the copyright symbol
+           ;; (C-in-a-circle), if this symbol is available in the user's
+           ;; locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
+           (G_ "(C)")
+           (G_ "the Guix authors\n"))
+   (display (G_"\
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
-"))
+")))
   (exit 0))
 
 (define (show-bug-report-information)