~ chicken-core (chicken-5) 49202a5c5f71667dbdeb4c18caa2dbe618ad8149
commit 49202a5c5f71667dbdeb4c18caa2dbe618ad8149
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Feb 28 14:02:12 2019 +0100
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Tue Mar 5 20:38:05 2019 +0100
chicken-install: exit with status 3 if no eggs are processed
Suggested by megane. User abort exits with status 2.
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/chicken-install.mdoc b/chicken-install.mdoc
index 2cdbac36..e6a8c773 100644
--- a/chicken-install.mdoc
+++ b/chicken-install.mdoc
@@ -138,7 +138,8 @@ defaults to
)
.El
.Sh EXIT STATUS
-.Ex -std
+The tool exits with status 1 on error, 2 after the user aborted an
+operation or 3 if it was invoked with no explicitly given egg names and no *.egg files could be found in the current directory.
.Sh EXAMPLES
Install
.Sq regex
diff --git a/chicken-install.scm b/chicken-install.scm
index 3edf293b..f35e4d28 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -773,7 +773,7 @@
(let ((r (trim (read-line))))
(cond ((string=? r "yes"))
((string=? r "no") #f)
- ((string=? r "abort") (exit 1))
+ ((string=? r "abort") (exit 2))
(else (loop))))))
(define (trim str)
@@ -1009,22 +1009,24 @@
(purge-mode (purge-cache eggs))
(print-repository (print (install-path)))
((null? eggs)
- (when cached-only
- (error "`-cached' needs explicit egg list"))
- (if list-versions-only
- (print "no eggs specified")
- (let ((files (glob "*.egg" "chicken/*.egg")))
- (set! canonical-eggs
- (map (lambda (fname)
- (list (pathname-file fname) (current-directory) #f))
- files))
- (set! requested-eggs (map car canonical-eggs))
- (retrieve-eggs '())
- (unless retrieve-only (install-eggs)))))
+ (cond (cached-only
+ (error "`-cached' needs explicit egg list"))
+ (list-versions-only
+ (print "no eggs specified"))
+ (else
+ (let ((files (glob "*.egg" "chicken/*.egg")))
+ (when (null? files) (exit 3))
+ (set! canonical-eggs
+ (map (lambda (fname)
+ (list (pathname-file fname) (current-directory) #f))
+ files))
+ (set! requested-eggs (map car canonical-eggs))
+ (retrieve-eggs '())
+ (unless retrieve-only (install-eggs))))))
(else
(let ((eggs (apply-mappings eggs)))
(cond (list-versions-only (list-egg-versions eggs))
- (else
+ (else
(set! requested-eggs (map (o car canonical) eggs))
(retrieve-eggs eggs)
(unless retrieve-only (install-eggs))))))))
@@ -1180,7 +1182,7 @@ EOF
(irregex-match-substring m 2)
eggs))
(loop (cdr args))))
- (else
+ (else
(set! eggs (cons arg eggs))
(loop (cdr args)))))))))
Trap