I'd like to scrub away method redefinition warnings, and I'm getting bogged 
down on how to read from the stream. It sounds simple in theory, but I'm 
not super familiar with pipes:

old_stderr = STDERR
outRead, outWrite = redirect_stderr()
... run some code
# TODO: read everything from outRead

# Close everything, reassign STDERR to old_stderr

I'm stuck on the TODO part. readavailable(outRead) hangs if there is 
nothing to read, and is criticized by @vtjnash 
<https://github.com/JuliaLang/julia/pull/7478>, but I don't understand his 
solution. Nor do I understand the race condition part --- isn't 
`close(outWrite)` blocking? And why does this code hang?

    close(outWrite)
    ss = readstring(outRead)

Shouldn't closing outWrite be the EOF for outRead? Closing outRead solves 
the hanging, but then readstring returns an empty vector.

Cédric

Reply via email to