diff options
author | Nikita Karetnikov <nikita@karetnikov.org> | 2013-09-24 22:11:16 +0000 |
---|---|---|
committer | Nikita Karetnikov <nikita@karetnikov.org> | 2013-09-25 16:07:50 +0000 |
commit | 0ab212b9466d5aa3fe801c9137248703245d8513 (patch) | |
tree | 26ead056ff74e396e4cf7d7cfb22d29b6fd59c14 /guix/scripts | |
parent | 98fbd7ceebd7930f23a8985b9080d3a7cac7818a (diff) | |
download | gnu-guix-0ab212b9466d5aa3fe801c9137248703245d8513.tar gnu-guix-0ab212b9466d5aa3fe801c9137248703245d8513.tar.gz |
guix package: Exit with 1 when a generation cannot be listed.
* guix/scripts/package.scm (guix-package)[process-query]: Exit with 1
when a generation does not exist or the profile points to the zeroth
generation.
* tests/guix-package.sh: Test the former case.
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/package.scm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1d00e39540..1f21890fcd 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -977,11 +977,16 @@ more information.~%")) (leave (_ "profile '~a' does not exist~%") profile)) ((string-null? pattern) - (for-each list-generation - (generation-numbers profile))) + (let ((numbers (generation-numbers profile))) + (if (equal? numbers '(0)) + (exit 1) + (for-each list-generation numbers)))) ((matching-generations pattern profile) => - (cut for-each list-generation <>)) + (lambda (numbers) + (if (null-list? numbers) + (exit 1) + (for-each list-generation numbers)))) (else (leave (_ "invalid syntax: ~a~%") pattern))) |