diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-05 12:18:19 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-05 12:24:29 -0700 |
commit | 1a1ca9a7fa4c30b3fd2d8dc58ae2e20971a7dde4 (patch) | |
tree | 45fa1d0d7a0361de5b46a6119b5739a2a476af61 /src/connection.lisp | |
parent | 7c4796c96b1f7cffe8012bb5585e05b273fecfb4 (diff) | |
download | consfigurator-1a1ca9a7fa4c30b3fd2d8dc58ae2e20971a7dde4.tar.gz |
add :PRINC argument to RUN & MRUN
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r-- | src/connection.lisp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index 10e0d74..079ef05 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -174,11 +174,12 @@ the root Lisp's machine. For example, using rsync(1) over SSH.")) :exit-code exit)))) (defmacro %process-run-args (&body forms) - `(let (cmd input may-fail for-exit env) + `(let (cmd input may-fail for-exit env princ) (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)) (:input (setq input (pop args))) (:env (setq env (pop args))) (t (mapc (lambda (e) @@ -221,6 +222,8 @@ 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* + - :INPUT INPUT -- pass the content of the string or stream INPUT on stdin - :ENV ENVIRONMENT -- where ENVIRONMENT is a plist specifying environment @@ -236,7 +239,8 @@ case return only the exit code." (connection-run *connection* cmd input) (let ((out (readfile stdout))) (if (or may-fail (= exit 0)) - (if for-exit exit (values out err exit)) + (progn (when princ (format t "~{ ~A~%~}" (lines out))) + (if for-exit exit (values out err exit))) (error 'run-failed :cmd cmd :stdout out :stderr err :exit-code exit))))))) @@ -256,7 +260,8 @@ start with RUN." (multiple-value-bind (out exit) (connection-run *connection* cmd input) (if (or may-fail (= exit 0)) - (if for-exit exit (values out exit)) + (progn (when princ (format t "~{ ~A~%~}" (lines out))) + (if for-exit exit (values out exit))) (error 'run-failed :cmd cmd :stdout out |