With this suggestion
function execute(cmd::Cmd)
out = Pipe()
err = Pipe()
process = run(pipeline(ignorestatus(cmd), stdout=out, stderr=err))
close(out.in)
close(err.in)
stdout = @async String(read(out))
stderr = @async String(read(err))
(
stdout = String(read(out)),
stderr = String(read(err)),
code = process.exitcode
)
end
julia> a, = execute(`cmd /c dir C:`); println(a)
julia> a, = execute(`cmd /c dir C:`); println(a)
julia> a, = execute(`cmd /c dir C:`); println(a)
(repeatdly enter the above by executing each line and then hitting the up arrow and executing again)
What you will see is that sometimes it prints the information , but also occasionally prints nothing. Is there a way to avoid this situation.