Created
August 3, 2018 11:59
-
-
Save wadie/442724b2eae912c78953ddcdff2da20e to your computer and use it in GitHub Desktop.
Remove warning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(2)> original_stderr = Process.whereis(:standard_error) | |
#PID<0.59.0> | |
iex(3)> Process.unregister(:standard_error) | |
true | |
iex(4)> {:ok, dev} = StringIO.open("") | |
{:ok, #PID<0.184.0>} | |
iex(5)> Process.register(dev, :standard_error) | |
true | |
iex(6)> IO.puts :stderr, "Oops!" | |
:ok | |
iex(7)> captured = StringIO.flush(dev) | |
"Oops!\n" | |
iex(8)> IO.write(original_stderr, captured) | |
Oops! | |
:ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment