How to redirect to "nothing" the standard output of a function I call?

Putting the last two answers together more concisely…

redirect_stdout(devnull) do ... end

EDIT: Should have tested it, it does not work :frowning_face:. This does:

redirect_stdout(open(tempname(), "w")) do; println(1) end

although it’s clearly suboptimal. I’d love to get an answer to this question

2 Likes