mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Add Timeout message when bootstraptest times out
This commit is contained in:
parent
b0b1712b52
commit
1582bd9382
1 changed files with 7 additions and 1 deletions
|
@ -625,6 +625,8 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Timeout < StandardError; end
|
||||||
|
|
||||||
def get_result_string(opt = '', timeout: BT.timeout, **argh)
|
def get_result_string(opt = '', timeout: BT.timeout, **argh)
|
||||||
if BT.ruby
|
if BT.ruby
|
||||||
timeout = BT.apply_timeout_scale(timeout)
|
timeout = BT.apply_timeout_scale(timeout)
|
||||||
|
@ -634,7 +636,11 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
|
||||||
out = IO.popen("#{BT.ruby} -W0 #{opt} #{filename}", **kw)
|
out = IO.popen("#{BT.ruby} -W0 #{opt} #{filename}", **kw)
|
||||||
pid = out.pid
|
pid = out.pid
|
||||||
th = Thread.new {out.read.tap {Process.waitpid(pid); out.close}}
|
th = Thread.new {out.read.tap {Process.waitpid(pid); out.close}}
|
||||||
th.value if th.join(timeout)
|
if th.join(timeout)
|
||||||
|
th.value
|
||||||
|
else
|
||||||
|
Timeout.new("timed out after #{timeout} seconds")
|
||||||
|
end
|
||||||
ensure
|
ensure
|
||||||
raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]
|
raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue