I want to run a process and capture its output. According the documentation, method open(command, stdio=devnull; write::Bool = false, read::Bool = !write)
should return a tuple (stream,process)
. But when running
typeof(open(`ls`))
the output is Base.Process
. So only the process is returned, no stream.
Am I misunderstanding the documentation? How do I start a process and somehow capture its output.
That is an error in the documentation (the function was changed between 0.6 and 1.0, but the docs were not updated).
You can just call any "reading" function, such as read
, eachline
or readlines
on the process, or even on the command itself, e.g.
readlines(open(`ls`))
readlines(`ls`)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With