summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-11-11 17:13:20 +0100
committerLudovic Courtès <ludo@gnu.org>2018-11-11 23:53:29 +0100
commit652163154c06b47936a453f44ea35938789718de (patch)
tree99cfd45eb491c64b891182961261487d6a781e08 /guix/scripts
parent9c001c07d4c483a4a6b7c7ff50b1119d3fd4b90f (diff)
guix package: '--show' errors when asked for a non-existent package.
Fixes <https://bugs.gnu.org/33323>. Reported by swedebugia <swedebugia@riseup.net>. * guix/scripts/package.scm (process-query): Call 'leave' when 'find-packages-by-name' returns the empty list. * tests/guix-package.sh: Test it.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/package.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 500fc9ac90..5743816324 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -771,9 +771,13 @@ processed, #f otherwise."
(('show requested-name)
(let-values (((name version)
(package-name->name+version requested-name)))
- (leave-on-EPIPE
- (for-each (cute package->recutils <> (current-output-port))
- (find-packages-by-name name version)))
+ (match (find-packages-by-name name version)
+ (()
+ (leave (G_ "~a~@[@~a~]: package not found~%") name version))
+ (packages
+ (leave-on-EPIPE
+ (for-each (cute package->recutils <> (current-output-port))
+ packages))))
#t))
(('search-paths kind)