Basically,
(uiop:run-program "echo hello" :output *standard-output*)
outputs hello
, while none of
(uiop:launch-program "echo hello" :output *standard-output*)
(uiop:launch-program "echo hello" :output #.*standard-output*)
(uiop:launch-program "echo hello" :output :interactive)
output anything; however, if I do run
(uiop:run-program "echo hello" :output *standard-output*)
after them, I do get hello
4 times indicating echo hello
did run. Why is this the case? ((force-output)
doesn't change anything either.)
Edit: I am using SBCL with SLIME. And as suggested in the comments, this works as-expected (I get the output) on running it from the terminal.
When you look at the implementations of
run-program
andlaunch-program
, you see that the former (in this caseā¦) does await-process
.If you issue a
uiop:wait-process
on the process-info returned bylaunch-program
, your output appears.I guess that it is a kind of race condition where swank or slime doesn't get to pick up the output before it does something else. I think that this is inherent in the asynchronous behaviour of
launch-program
.I think that the clearest way to get the output is to specify
:output :stream
and then use the stream available from callingprocess-info-output
on the return value oflaunch-program
.