Skip to content
Snippets Groups Projects
Commit 129b80fb authored by Mislav Marohnić's avatar Mislav Marohnić Committed by Adam Vandenberg
Browse files

simplify the $stdout hijack in `doctor` command

parent bcb8fcf6
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment