Thanks, Jameson. That explains, why I cannot catch errors, only warnings. That is, the following code will not (and I verified, it does not) work. ~~~ begin stderr_orig = STDERR rd, wr = redirect_stderr() try error("HI") ### finally redirect_stderr(stderr_orig) close(wr) out = readall(rd) println(length(out),out) end end ~~~
Is there a trick to catch the error message and return it in a variable? On Saturday, June 21, 2014 11:13:51 AM UTC-6, Jameson wrote: > > *julia> **begin* > > *stderr_orig = STDERR* > > *rd, wr = redirect_stderr()* > > *try* > > *warn("HI")* > > *finally* > > *redirect_stderr(stderr_orig)* > > *close(wr)* > > *out = readall(rd)* > > *println(length(out),out)* > > *end* > > *end* > > 25*WARNING: HI* > > > *in you example, code, throwing an error does not cause anything to be > written to stdout, it is a break in control flow that gets caught by the > REPL, skipping execution of all of the rest of your code.* > > > *Note that the calls to both redirect_stderr and close are necessary > before readall, because we have multiple handles to the write end of the > pipe, and need to close all of them before the read end will receive the > EOF signal* > > > On Sat, Jun 21, 2014 at 12:51 PM, Laszlo Hars <laszl...@gmail.com > <javascript:>> wrote: > >> ...can someone at least verify that the 0.3.0 Julia console output in >> Windows is not written to STDOUT, and error messages are not written to >> STDERR? (The results of print() do appear on STDOUT) >> > >