Change local runs to use rsync/candle to capture errors
authorFrank Duncan <frank@kank.net>
Thu, 16 Dec 2021 05:32:22 +0000 (23:32 -0600)
committerFrank Duncan <frank@kank.net>
Thu, 16 Dec 2021 05:32:22 +0000 (23:32 -0600)
candle.asd
src/main/local/.gitignore [new file with mode: 0644]
src/main/local/config.lisp.tmpl [new file with mode: 0644]
src/main/local/local.lisp

index e65a5027151815d7ca5c13a83f196082ccb8be20..30a6da37d1c87f76a6b402ca7b8d8cd6d67cfc31 100644 (file)
@@ -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 (file)
index 0000000..262158a
--- /dev/null
@@ -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 (file)
index 0000000..41c7340
--- /dev/null
@@ -0,0 +1,4 @@
+(in-package #:candle-local)
+
+(setf *rsync-exec* "/usr/bin/rsync")
+(setf *candle-location* "/path/to/candle/exec")
index bce245b985783a8ed6b44a282004b675b6a98313..8eded5aa4f42eedcb905ea05a04b04dc96ce275d 100644 (file)
@@ -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)))