From 8c9f0120cae52d60704e83f61b278b009b897422 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 23 Sep 2015 15:40:27 +0800 Subject: [PATCH] Formula#system: print dot for travis --- Library/Homebrew/cmd/test-bot.rb | 8 ++++++-- Library/Homebrew/formula.rb | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 04410b1874..3f3e9ae52f 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -530,7 +530,7 @@ module Homebrew formula_fetch_options << canonical_formula_name test "brew", "fetch", "--retry", *formula_fetch_options test "brew", "uninstall", "--force", canonical_formula_name if formula.installed? - install_args = [] + install_args = ["--verbose"] install_args << "--build-bottle" unless ARGV.include? "--no-bottle" install_args << "--HEAD" if ARGV.include? "--HEAD" @@ -848,7 +848,11 @@ module Homebrew ENV["HOMEBREW_SANDBOX"] = "1" ENV["HOMEBREW_NO_EMOJI"] = "1" ENV["HOMEBREW_FAIL_LOG_LINES"] = "150" - ARGV << "--verbose" if ENV["TRAVIS"] + + if ENV["TRAVIS"] + ARGV << "--verbose" + ENV["HOMEBREW_VERBOSE_USING_DOTS"] = "1" + end if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \ || ARGV.include?("--ci-testing") diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 3e7e24d431..ef76eb0231 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1255,6 +1255,8 @@ class Formula # system "make", "install" def system(cmd, *args) verbose = ARGV.verbose? + verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil? + # remove "boring" arguments so that the important ones are more likely to # be shown considering that we trim long ohai lines to the terminal width pretty_args = args.dup @@ -1288,9 +1290,23 @@ class Formula end wr.close - while buf = rd.gets - log.puts buf - puts buf + if verbose_using_dots + last_dot = Time.at(0) + while buf = rd.gets + log.puts buf + # make sure dots printed with interval of at least 1 min. + if (Time.now - last_dot) > 60 + print "." + $stdout.flush + last_dot = Time.now + end + end + puts + else + while buf = rd.gets + log.puts buf + puts buf + end end ensure rd.close