aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMislav Marohnić2011-05-21 03:40:48 +0200
committerAdam Vandenberg2011-06-03 21:15:58 -0700
commit129b80fb9b5eac7f644e1e73e55bcb1fb31ffca0 (patch)
treed8514ad03f216ca7a70f04f9b836208e87a0475c /Library/Homebrew
parentbcb8fcf6dc7df6a2b60abb9783e468f67e5a5eee (diff)
downloadbrew-129b80fb9b5eac7f644e1e73e55bcb1fb31ffca0.tar.bz2
simplify the $stdout hijack in `doctor` command
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/doctor.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index ddaffeb86..72b64cf29 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -1,3 +1,5 @@
+require 'stringio'
+
class Volumes
def initialize
@volumes = []
@@ -699,12 +701,10 @@ end
module Homebrew extend self
def doctor
- read, write = IO.pipe
-
- if fork == nil
- read.close
- $stdout.reopen write
+ old_stdout = $stdout
+ $stdout = output = StringIO.new
+ begin
check_usr_bin_ruby
check_homebrew_prefix
check_for_macgpg2
@@ -738,17 +738,15 @@ module Homebrew extend self
check_for_autoconf
check_for_linked_kegonly_brews
check_for_other_frameworks
+ ensure
+ $stdout = old_stdout
+ end
- exit! 0
+ unless (warnings = output.string).chomp.empty?
+ puts warnings
else
- write.close
-
- unless (out = read.read).chomp.empty?
- puts out
- else
- puts "Your OS X is ripe for brewing."
- puts "Any troubles you may be experiencing are likely purely psychosomatic."
- end
+ puts "Your OS X is ripe for brewing."
+ puts "Any troubles you may be experiencing are likely purely psychosomatic."
end
end
end