In an effort to improve VideoIO.jl, we are trying to capture both STDOUT 
and STDERR output of a call to an external binary from the Julia REPL. I 
tried a few suggestions based on previous discussions (JuliaLang/julia#3823 
<https://github.com/JuliaLang/julia/issues/3823>, Capture the output of 
Julia's console 
<https://groups.google.com/forum/#!topic/julia-users/3wGChHHYoxo>)  on how 
to this but none of them worked from the Julia REPL in this case.

I can direct both STDOUT and STDERR output to a .txt file when calling the 
following from the bash terminal:

$ julia -e 'open(`/usr/local/Cellar/ffmpeg/2.4.2/bin/ffmpeg -list_devices true 
-f avfoundation -i \" \"`)' 1> stdout.txt 2> stderr.txt


However, when using the equivalent call from inside the julia REPL:

f=open(`/usr/local/Cellar/ffmpeg/2.4.2/bin/ffmpeg -list_devices true -f 
avfoundation -i \" \"`, "r", STDERR)readall(f)


ERROR: `readall` has no method matching readall(::(Pipe,Process))


I know there is a way to capture all the output but it requires exiting the 
Julia REPL.   Does anyone know a relatively straightforward way to capture 
STDOUT and STDERR from Julia -- without exiting the Julia REPL?

Reply via email to