I'm trying to interact with an exterior program, and can't get it to work as I want. Let's say the program is "od" for example. I try:
julia> (so,si,pr) = readandwrite(`od`) (Pipe(open, 0 bytes waiting),Pipe(open, 0 bytes waiting),Process(`od`, ProcessRunning)) julia> write(si,repeat("test\n",100)) 500 julia> flush(si) Pipe(open, 0 bytes waiting) julia> readline(so) ^C # nothing happens, the process is blocking output How do I manage to get Julia to give me the output of od? A line was already ready after the first 16 characters of input. This is related to buffering: if I stuff the buffer, then I do get lines asynchronously: julia> (so,si,pr) = readandwrite(`od`); julia> write(si,repeat("test\n",10000)); julia> readline(so) "0000000 062564 072163 072012 071545 005164 062564 072163 072012\n" However, there also seems to be a bug in Julia here: julia> (so,si,pr) = readandwrite(`od`); julia> write(si,repeat("test\n",100000)); # and Julia is stuck ^CERROR: InterruptException: ERROR (unhandled task failure): write: broken pipe (EPIPE) in yieldto at ./task.jl:21 in wait at ./task.jl:309 in wait at ./task.jl:225 in wait_full at ./multi.jl:573 in take! at ./multi.jl:744 in take_ref at ./multi.jl:752 in call_on_owner at ./multi.jl:718 in anonymous at task.jl:86 julia> pr # hmmm... I wonder in which state the process is ^CERROR: InterruptException: bash$ # Julia crashed