From cddc3649a726f3660ff74ef1283c98df99782da2 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 28 Sep 2012 09:49:05 -0400 Subject: [PATCH] Safer way to redirect puts to a file --- Library/Homebrew/cmd/--config.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb index f72cbedffa..1781d33a76 100644 --- a/Library/Homebrew/cmd/--config.rb +++ b/Library/Homebrew/cmd/--config.rb @@ -113,10 +113,11 @@ module Homebrew extend self end def write_build_config f - $f = f - def Homebrew.puts(*foo); $f.puts(*foo); end + stdout = $stdout + $stdout = f Homebrew.dump_build_config - class << Homebrew; undef :puts; end + ensure + $stdout = stdout end def dump_verbose_config