Skip to content

Instantly share code, notes, and snippets.

@yalab
Created December 21, 2011 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yalab/1504270 to your computer and use it in GitHub Desktop.
Save yalab/1504270 to your computer and use it in GitHub Desktop.
STDERR redirect to STDOUT
# 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