From 1fa17ffd12279c98bb4e65565a619f032c2cac94 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 7 Aug 2022 11:36:08 -0500 Subject: [refactor] run-with-shell. timeout now holds between reads --- lib/running.lisp | 17 +++++++---------- 1 file 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)))))) -- cgit v1.2.3