JuliaLang/julia

Redirect output to an IOBuffer

Open

#12,711 创建于 2015年8月20日

在 GitHub 查看
 (19 评论) (20 反应) (0 负责人)Julia (48,709 star) (5,773 fork)batch import
help wantedio

描述

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.)

贡献者指南

Redirect output to an IOBuffer · JuliaLang/julia#12711 | Good First Issue