Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: would it be possible to add lock() (and possibly other methods) to DevNullStream? #12050

Closed
sbromberger opened this issue Jul 7, 2015 · 8 comments

Comments

@sbromberger
Copy link
Contributor

julia> println(DevNull,"foo")
ERROR: type DevNullStream has no field lock
 in println at stream.jl:226

(I'm looking for a system-independent way to throw away println output. Am I doing it the right way?)

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jul 8, 2015

sgtm

@hayd
Copy link
Member

hayd commented Aug 15, 2015

+1.

FWIW I've also seen ERROR: LoadError: type DevNullStream has no field handle. From comments elsewhere (not sure where!) I used plain redirect_stdout:

old_stdout = STDOUT
redirect_stdout()
try
    do_stuff
finally
   redirect_stdout(old_stdout)
end

Similar functions are available for stderr and stdin.

For anyone arriving here from google... or github search.

@JeffBezanson
Copy link
Sponsor Member

@vtjnash close?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Aug 26, 2015

I don't think I added enough of the methods to get this complete. someone should be able to clone the complete set of methods added to AbstractPipe over to DevNullStream to get full coverage and close this issue.

@tkelman
Copy link
Contributor

tkelman commented Sep 14, 2015

fixed by #12839, right?

@tkelman tkelman closed this as completed Sep 14, 2015
@vtjnash
Copy link
Sponsor Member

vtjnash commented Sep 14, 2015

mostly, although perhaps not entirely

vtjnash added a commit that referenced this issue Sep 28, 2015
@sbromberger
Copy link
Contributor Author

Actually, I'm just getting back to this and it's not doing what I had hoped:

julia> redirect_stdout(DevNull)
ERROR: MethodError: no method matching redirect_stdout(::Base.DevNullStream)
Closest candidates are:
  redirect_stdout() at stream.jl:1034
  redirect_stdout(::Union{Base.LibuvStream, IOStream}) at stream.jl:1028
  redirect_stdout(::Function, ::Any) at stream.jl:1082

Time for a new issue/request?

@StefanKarpinski
Copy link
Sponsor Member

Yes, please – seems like a more specific issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants