Prevent Travis timeout. (#50725)

This commit is contained in:
Markus Reiter
2018-08-13 07:54:34 +02:00
committed by GitHub
parent b7cc48ac15
commit b529bfab47
3 changed files with 25 additions and 21 deletions
+16 -5
View File
@@ -15,6 +15,9 @@ module Hbc
raise CaskError, "This command isnt meant to be run locally."
end
$stdout.sync = true
$stderr.sync = true
unless tap
raise CaskError, "This command must be run from inside a tap directory."
end
@@ -96,7 +99,15 @@ module Hbc
Travis.fold travis_id do
print "#{Tty.bold}#{Tty.yellow}#{name}#{Tty.reset} "
$stdout.flush
real_stdout = $stdout.dup
travis_wait = Thread.new do
loop do
sleep 595
real_stdout.print "\u200b"
end
end
success, output = capture do
begin
@@ -107,9 +118,12 @@ module Hbc
end
end
travis_wait.kill
travis_wait.join
if success
puts Formatter.success("")
puts output
puts output unless output.empty?
else
puts Formatter.error("")
end
@@ -118,9 +132,6 @@ module Hbc
puts output unless success
success
ensure
$stdout.flush
$stderr.flush
end
def tap
-1
View File
@@ -12,7 +12,6 @@ def capture
begin
yield
ensure
w.flush
w.close
end
end
+9 -15
View File
@@ -4,34 +4,28 @@ module Travis
@start = {}
def fold(id, &block)
begin
puts fold_start(id)
time(rand(2**32).to_s(16), &block)
ensure
puts fold_end(id)
$stdout.flush
$stderr.flush
end
print fold_start(id)
time(rand(2**32).to_s(16), &block)
print fold_end(id)
end
def fold_start(id)
"travis_fold:start:#{id}"
"travis_fold:start:#{id}\r\033[0K"
end
def fold_end(id)
"travis_fold:end:#{id}"
"travis_fold:end:#{id}\r\033[0K"
end
def time(id)
puts time_start(id)
print time_start(id)
yield
ensure
puts time_end(id)
print time_end(id)
end
def time_start(id)
@start[id] = Time.now
"travis_time:start:#{id}"
"travis_time:start:#{id}\r\033[0K"
end
def time_end(id)
@@ -39,6 +33,6 @@ module Travis
finish = (Time.now.to_f * 1_000_000_000).to_i
duration = finish - start
"travis_time:end:#{id},start=#{start},finish=#{finish},duration=#{duration}"
"travis_time:end:#{id},start=#{start},finish=#{finish},duration=#{duration}\r\033[0K"
end
end