diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-21 17:21:11 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-21 17:22:25 -0700 |
commit | 3a7b35372040ca245969826bd5fa9f85a6980486 (patch) | |
tree | d42c5d2c28d4883e406606e2152f9f9bffc12741 /src/connection.lisp | |
parent | d6e52cbd4a178bdae7961c6f199a99724bb9d04e (diff) | |
download | consfigurator-3a7b35372040ca245969826bd5fa9f85a6980486.tar.gz |
add facility for more regular progress and debug printing
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r-- | src/connection.lisp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index d1c87e2..4b86b04 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -217,12 +217,12 @@ which will be cleaned up when BODY is finished." :exit-code exit)))))) (defmacro %process-run-args (&body forms) - `(let (cmd input may-fail for-exit env princ) + `(let (cmd input may-fail for-exit env inform) (loop for arg = (pop args) do (case arg - (:for-exit (setq may-fail t for-exit t)) - (:may-fail (setq may-fail t)) - (:princ (setq princ t)) + (:for-exit (setq may-fail t for-exit t)) + (:may-fail (setq may-fail t)) + (:inform (setq inform t)) (:input (setq input (pop args))) (:env (setq env (pop args))) (t (mapc (lambda (e) @@ -265,7 +265,7 @@ Keyword arguments accepted: does not exit nonzero, usually because it is being called partly or only for its exit code - - :PRINC -- send a copy of the output to *STANDARD-OUTPUT* + - :INFORM -- send a copy of the output to *STANDARD-OUTPUT* - :INPUT INPUT -- pass the content of the string or stream INPUT on stdin @@ -278,10 +278,11 @@ case return only the exit code." (%process-run-args (with-remote-temporary-file (stdout) (setq cmd (format nil "( ~A ) >~A" cmd stdout)) + (informat 3 "RUN ~A" cmd) (multiple-value-bind (err exit) (connection-run *connection* cmd input) (let ((out (readfile stdout))) - (when princ (format t "~{ ~A~%~}" (lines out))) + (when inform (informat 1 "~{ ~A~%~}" (lines out))) (if (or may-fail (= exit 0)) (if for-exit exit (values out err exit)) (error 'run-failed @@ -300,9 +301,10 @@ Some :POSIX properties which want to run a lot of commands and don't need to separate the streams might want to use this too, but usually it is best to start with RUN." (%process-run-args + (informat 3 "MRUN ~A" cmd) (multiple-value-bind (out exit) (connection-run *connection* cmd input) - (when princ (format t "~{ ~A~%~}" (lines out))) + (when inform (informat 1 "~{ ~A~%~}" (lines out))) (if (or may-fail (= exit 0)) (if for-exit exit (values out exit)) (error 'run-failed |