Skip to content

Commit

Permalink
Be gentle when stdout is not a tty
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information
jacknagel committed Feb 10, 2012
1 parent fde86b2 commit 6cc8e95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/Homebrew/utils.rb
Expand Up @@ -33,13 +33,13 @@ def escape n

# args are additional inputs to puts until a nil arg is encountered
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 sput unless sput.empty?
end

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}"
end

Expand Down Expand Up @@ -112,6 +112,7 @@ def curl *args
# See https://github.com/mxcl/homebrew/issues/6103
args << "--insecure" if MacOS.version < 10.6
args << "--verbose" if ENV['HOMEBREW_CURL_VERBOSE']
args << "--silent" unless $stdout.tty?

safe_system curl, *args
end
Expand Down

0 comments on commit 6cc8e95

Please sign in to comment.