Is there a null IOStream?

121 views
Skip to first unread message

K Leo

unread,
Dec 7, 2014, 7:24:53 PM12/7/14
to julia...@googlegroups.com
At times I don't want to output anything, so I pass a null IOStream to a
function that requires an IOStream. How to do that?

Matt Bauman

unread,
Dec 7, 2014, 10:08:28 PM12/7/14
to julia...@googlegroups.com
It'd be nice if the DevNull object (http://docs.julialang.org/en/latest/stdlib/base/#Base.DevNull) would work for this, but it seems like it only works for command redirection right now:

julia> run(`echo "Hello"` |> DevNull)

julia> print(DevNull, "Hello")
ERROR: type DevNullStream has no field status
 in isopen at stream.jl:286
 in check_open at stream.jl:293
 in write at stream.jl:730
 in print at ascii.jl:93

K Leo

unread,
Dec 7, 2014, 10:29:04 PM12/7/14
to julia...@googlegroups.com
Even if I could check something like the following is better:

isopen(DevNull)

Stefan Karpinski

unread,
Dec 7, 2014, 11:40:05 PM12/7/14
to Julia Users, Keno Fischer, Jameson Nash
cc:ing Keno and Jameson as the authors of DevNull.

Keno Fischer

unread,
Dec 7, 2014, 11:42:08 PM12/7/14
to Stefan Karpinski, Julia Users, Jameson Nash
I don't see a good reason for DevNull not to behave like this.
Reply all
Reply to author
Forward
0 new messages