Created
December 21, 2011 02:20
-
-
Save yalab/1504270 to your computer and use it in GitHub Desktop.
STDERR redirect to STDOUT
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
# stderr_to_stdout do | |
# warn("warning message") | |
# end | |
module Kernel | |
def stderr_to_stdout | |
old_std_err = STDERR.clone | |
STDERR.reopen(STDOUT) | |
yield | |
ensure | |
STDERR.reopen(old_std_err) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment