aboutsummaryrefslogtreecommitdiff
path: root/lib/running.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-08-07 11:36:08 -0500
committerColin Okay <colin@cicadas.surf>2022-08-07 11:36:08 -0500
commit1fa17ffd12279c98bb4e65565a619f032c2cac94 (patch)
tree7515506b97791ff40f9e663dc754a538173b71ea /lib/running.lisp
parentb46a00f1856947d66c8f74b9f24f7574133a1663 (diff)
[refactor] run-with-shell. timeout now holds between reads
Diffstat (limited to 'lib/running.lisp')
-rw-r--r--lib/running.lisp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/running.lisp b/lib/running.lisp
index 3289e75..b3a0b52 100644
--- a/lib/running.lisp
+++ b/lib/running.lisp
@@ -42,18 +42,15 @@ with SHELL-NAME. The output from the command read line by line and is
printed to OUTPUT-STREAM. "
(let ((shell
(uiop:launch-program shell-name :input :stream :output :stream)))
- (symbol-macrolet ((shell-input (uiop:process-info-input shell))
- (shell-output (uiop:process-info-output shell)))
+ (let ((shell-input (uiop:process-info-input shell))
+ (shell-output (uiop:process-info-output shell)))
(write-line command shell-input)
(finish-output shell-input)
- (if (and await-output-p
- (plusp await-output-p)
- (wait-until (:timeout await-output-p :poll-every 0.005)
- (listen shell-output)))
- (loop while (listen shell-output)
- do (princ (read-line shell-output) output-stream)
- (terpri output-stream)
- (sleep 0.005))))))
+ (when (and await-output-p (plusp await-output-p))
+ (loop while (wait-until (:timeout await-output-p :poll-every 0.05)
+ (listen shell-output))
+ do (princ (read-line shell-output) output-stream)
+ (terpri output-stream))))))