From 652446a34d51f0bcb7f9b05300228e6ad7305237 Mon Sep 17 00:00:00 2001 From: felix Date: Thu, 28 Feb 2019 14:02:12 +0100 Subject: [PATCH] chicken-install: exit with status 3 if no eggs are processed Suggested by megane. User abort exits with status 2. --- chicken-install.mdoc | 3 ++- chicken-install.scm | 28 +++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) 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..ef483cc7 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,18 +1009,20 @@ (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)) -- 2.16.2