From: Frank Duncan Date: Thu, 16 Dec 2021 05:32:22 +0000 (-0600) Subject: Change local runs to use rsync/candle to capture errors X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=6d4f6ed548e71c00114b5102e725887e379dbc0e;p=candle Change local runs to use rsync/candle to capture errors --- diff --git a/candle.asd b/candle.asd index e65a502..30a6da3 100644 --- a/candle.asd +++ b/candle.asd @@ -20,4 +20,4 @@ (asdf:defsystem candle-local :pathname "src/main/local" - :components ((:file "local"))) + :components ((:file "local") (:file "config"))) diff --git a/src/main/local/.gitignore b/src/main/local/.gitignore new file mode 100644 index 0000000..262158a --- /dev/null +++ b/src/main/local/.gitignore @@ -0,0 +1 @@ +config.lisp diff --git a/src/main/local/config.lisp.tmpl b/src/main/local/config.lisp.tmpl new file mode 100644 index 0000000..41c7340 --- /dev/null +++ b/src/main/local/config.lisp.tmpl @@ -0,0 +1,4 @@ +(in-package #:candle-local) + +(setf *rsync-exec* "/usr/bin/rsync") +(setf *candle-location* "/path/to/candle/exec") diff --git a/src/main/local/local.lisp b/src/main/local/local.lisp index bce245b..8eded5a 100644 --- a/src/main/local/local.lisp +++ b/src/main/local/local.lisp @@ -1,20 +1,29 @@ (in-package #:candle-local) +(defvar *rsync-exec*) +(defvar *candle-location*) + (defmethod candle:process-job-in-system ((job-system (eql :local)) job) (let ((work-dir (format nil "~Awork/" candle:*candle-dir*)) - (result nil)) + (out nil) + (code nil)) (sb-ext:run-program - "/bin/cp" + *rsync-exec* (list - "-ap" + "-az" + "--delete" (candle:project-dir (candle:job-project job)) work-dir)) - (let* - ((*default-pathname-defaults* (pathname work-dir)) - (*error-output* (make-broadcast-stream)) - (output - (with-output-to-string (*standard-output*) - (setf result (candle:run))))) - (sb-ext:delete-directory work-dir :recursive t) - (values result output)))) + (setf out + (with-output-to-string (out-str) + (setf code + (sb-ext:process-exit-code + (sb-ext:run-program + *candle-location* + (list "run") + :directory work-dir + :output out-str + :error out-str + :wait t))))) + (values (zerop code) out)))