I tried to get answers in various threads to my question below, but so far 
nobody could help. Let me try in a separate thread… I use the latest Julia 
0.3.0 nightly under Windows.

The problem: I have computer generated Julia code. The simplest case is 
when a block of Julia instructions is copied to the clipboard, which can be 
simply pasted to the Julia console, and run.

I'd like to capture the Julia output seen in the console, and either log it 
in a file, or better yet, return it to the caller application via the 
Windows clipboard. There are two problems

-          If the pasted Julia instructions have syntax errors, the Julia 
error messages cannot be caught with some surrounding Julia instructions, 
because the execution of the pasted block of code is aborted

-          Normal console output does not seem to always appear in STDOUT. 
I'd like to get the output of code, like

for i = 1:3 println((i,i^2)) end # results appear in STDOUT

or

a=1;b=2;a+b # nothing is seen in STDOUT

The Julia nightly versions a couple months ago allowed simple redirections 
of STDOUT and STDERR to user pipes, from where the data could be read. 
Everything used to work fine, but not anymore.

Thus my question is: can we redirect everything written to the Julia 
console to a pipe or to file; or otherwise capture all the output text?

Reply via email to