> you wouldn't necessarily expect to see documentation of the REPL's 
low-level terminal-communication internals
I understand. However, as we learn the language we use the REPL. It is the 
first thing we see of Julia. A clear distinction in the documentation would 
be really helpful telling what of the Julia features works in the REPL and 
what does not.

> trying to hack the REPL for a task to which it is poorly suited
This "hacks" have been working for me. I could achieve everything I wanted 
with 8-10 lines of Julia code.

> Multiple alternative suggestions have been offered for better ways to 
communicate between Julia and an external process, but you've rejected them
I did not ask help "to communicate between Julia and an external process". 
I posted several code snippets, which do accomplish that task, with 8-10 
lines of code. I asked help to capture the output of the REPL. I could not 
imagine that it was that hard. I believe it should not be.

It is an entirely different conversation to discuss if I need to capture 
the output of the REPL, and if I could achieve the same or better results 
with something else. I would be glad to discuss that, but the point here 
was simply how I can capture the output of Julia's console. As I understand 
now, the only way is to define my own terminal and replace the REPL 
terminal with it.


On Thursday, July 17, 2014 12:20:19 PM UTC-6, Steven G. Johnson wrote:
>
> As I understand it, the REPL makes a private copy of the output-stream 
> descriptors early on, which is why you can't redirect them.    This is 
> actually quite useful behavior, because otherwise it would be impossible to 
> debug code using redirect_stdout etc. in the REPL (because the REPL would 
> stop working as soon as you redirect).   (The REPL also needs to be able to 
> talk to the terminal at a lower level than just stdout in order to support 
> things like line editing.)  Also note that the REPL is a program written in 
> Julia, not a part of the Julia language or standard library, so you 
> wouldn't necessarily expect to see documentation of the REPL's low-level 
> terminal-communication internals.
>
> On Wednesday, July 16, 2014 8:48:11 PM UTC-4, Laszlo Hars wrote:
>>
>> I don't know, how to file an issue. Where can I get instructions? (The 
>> STDERR behavior may be intentional. I kept asking about it in this group, 
>> for months, but nobody was interested.)
>>
>
> The difficulty here is that you are trying to hack the REPL for a task to 
> which it is poorly suited.  Multiple alternative suggestions have been 
> offered for better ways to communicate between Julia and an external 
> process, but you've rejected them.   Basically, you should set up a channel 
> to receive messages, execute the code yourself, catch errors yourself, and 
> then you can do whatever you want with the output, rather than trying to 
> intercept it from the REPL.   We didn't write all of your code for you, but 
> we gave enough examples that you should be able to implement what you need.
>
> Note that this is independent from whether you want the REPL to be running 
> too, in order to be able to use Julia interactively with the same data.   
> Just run your receive-execute-respond loop in another thread (asynchronous 
> task), and you can have the REPL running at the same time.
>
> Another example is IJulia, which receives messages with Julia code from 
> another process (the IPython front-end) and then sends back the results, 
> including errors.   IJulia never invokes the REPL at all.
>

Reply via email to