guix package: Swallow EPIPE upon 'guix package --list-generations'.

Fixes <http://bugs.gnu.org/27017>.
Reported by Alex Vong <alexvong1995@gmail.com>.

* guix/scripts/package.scm (process-query) <'list-generations>: Wrap
body in 'leave-on-EPIPE'.
This commit is contained in:
Ludovic Courtès 2017-05-23 22:45:03 +02:00
parent 59d0f067ff
commit 807ba51950
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 20 additions and 18 deletions

View File

@ -681,24 +681,26 @@ processed, #f otherwise."
(unless (null-list? (cdr numbers))
(display-profile-content-diff profile (car numbers) (cadr numbers))
(diff-profiles profile (cdr numbers))))
(cond ((not (file-exists? profile)) ; XXX: race condition
(raise (condition (&profile-not-found-error
(profile profile)))))
((string-null? pattern)
(list-generation display-profile-content
(car (profile-generations profile)))
(diff-profiles profile (profile-generations profile)))
((matching-generations pattern profile)
=>
(lambda (numbers)
(if (null-list? numbers)
(exit 1)
(leave-on-EPIPE
(list-generation display-profile-content (car numbers))
(diff-profiles profile numbers)))))
(else
(leave (G_ "invalid syntax: ~a~%")
pattern)))
(leave-on-EPIPE
(cond ((not (file-exists? profile)) ; XXX: race condition
(raise (condition (&profile-not-found-error
(profile profile)))))
((string-null? pattern)
(list-generation display-profile-content
(car (profile-generations profile)))
(diff-profiles profile (profile-generations profile)))
((matching-generations pattern profile)
=>
(lambda (numbers)
(if (null-list? numbers)
(exit 1)
(begin
(list-generation display-profile-content (car numbers))
(diff-profiles profile numbers)))))
(else
(leave (G_ "invalid syntax: ~a~%")
pattern))))
#t)
(('list-installed regexp)