From e8e6fda136aeb7ee54d71670d6b9242d0aa132ee Mon Sep 17 00:00:00 2001 From: Frank Duncan Date: Thu, 9 Dec 2021 13:28:58 -0600 Subject: [PATCH] Handle task failure correctly --- src/main/cli.lisp | 2 +- src/main/run.lisp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/cli.lisp b/src/main/cli.lisp index 08bd93b..006830e 100644 --- a/src/main/cli.lisp +++ b/src/main/cli.lisp @@ -79,7 +79,7 @@ ((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle run --help'.~%" (car remaining-args))) (remaining-args (format *error-output* "Unknown option: ~A. See 'candle run --help'.~%" (car remaining-args))) ((opera:option-present :help options) (format t "~A" (opera:usage "candle run" (run-options)))) - (t (candle:run))))) + ((not (candle:run)) (sb-ext:exit :code 1))))) (defun run () (multiple-value-bind (options remaining-args error) (opera:process-arguments (main-options) (cdr sb-ext:*posix-argv*)) diff --git a/src/main/run.lisp b/src/main/run.lisp index fa9edbe..d6b963c 100644 --- a/src/main/run.lisp +++ b/src/main/run.lisp @@ -5,9 +5,10 @@ (defun run-task (task) (format t "~%~c[1;33mRunning ~:(~A~)~c[0m~%" #\Esc (getf task :name) #\Esc) - (eval (getf task :directions)) -; (format t "~c[1;31mFailed doc check!~c[0m~%" #\Esc #\Esc) - (format t "~c[1;32m- ~:(~A~) Passed!~c[0m~%" #\Esc (getf task :name) #\Esc)) + (if + (eval (getf task :directions)) + (progn (format t "~c[1;32m- ~:(~A~) Passed!~c[0m~%" #\Esc (getf task :name) #\Esc) t) + (format t "~c[1;31m- ~:(~A~) Failed!~c[0m~%" #\Esc (getf task :name) #\Esc))) (defun run () (if @@ -19,4 +20,4 @@ (let ((candle-definition (read str))) (format t "Running tasks for ~(~A~)~%" (getf candle-definition :name)) - (mapcar #'run-task (getf candle-definition :tasks)))))) + (every #'identity (mapcar #'run-task (getf candle-definition :tasks))))))) -- 2.25.1