Be gentle when stdout is not a tty

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-02-10 17:47:39 -06:00
parent c5592b83b2
commit ddde478f63

View File

@ -33,13 +33,13 @@ end
# args are additional inputs to puts until a nil arg is encountered # args are additional inputs to puts until a nil arg is encountered
def ohai title, *sput def ohai title, *sput
title = title.to_s[0, Tty.width - 4] unless ARGV.verbose? title = title.to_s[0, Tty.width - 4] if $stdout.tty? unless ARGV.verbose?
puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}" puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}"
puts sput unless sput.empty? puts sput unless sput.empty?
end end
def oh1 title def oh1 title
title = title.to_s[0, Tty.width - 4] unless ARGV.verbose? title = title.to_s[0, Tty.width - 4] if $stdout.tty? unless ARGV.verbose?
puts "#{Tty.green}==> #{Tty.reset}#{title}" puts "#{Tty.green}==> #{Tty.reset}#{title}"
end end
@ -112,6 +112,7 @@ def curl *args
# See https://github.com/mxcl/homebrew/issues/6103 # See https://github.com/mxcl/homebrew/issues/6103
args << "--insecure" if MacOS.version < 10.6 args << "--insecure" if MacOS.version < 10.6
args << "--verbose" if ENV['HOMEBREW_CURL_VERBOSE'] args << "--verbose" if ENV['HOMEBREW_CURL_VERBOSE']
args << "--silent" unless $stdout.tty?
safe_system curl, *args safe_system curl, *args
end end