JuliaLang/julia

Redirect output to an IOBuffer

Offen

#12.711 geöffnet am 20.08.2015

 (19 Kommentare) (20 Reaktionen) (0 zugewiesene Personen)Julia (5.773 Forks)batch import
help wantedio

Repository-Metriken

Stars
 (48.709 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 20T 6h) (157 gemergte PRs in 30 T)

Beschreibung

It'd be really nice to be able to redirect stdout/err to an IOBuffer:

julia> b = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> redirect_stdout(b)
ERROR: MethodError: `redirect_stdout` has no method matching redirect_stdout(::Base.AbstractIOBuffer{Array{UInt8,1}})

I thought I saw another similar issue the other day, but was unable to locate it.

(Aside/another issue it would be nice to write this as a do block.)

Contributor Guide