mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revert "bootstraptest/runner: speed up assert_finish by avoiding sleep"
This reverts commit r63754. Many CI servers still use old ruby as base ruby which does not support read_nonblock. https://rubyci.org/logs/www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180627T013100Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
529af9c821
commit
e3e22c551d
1 changed files with 3 additions and 8 deletions
|
@ -373,18 +373,13 @@ def assert_finish(timeout_seconds, testsrc, message = '')
|
|||
io = IO.popen("#{@ruby} -W0 #{filename}")
|
||||
pid = io.pid
|
||||
waited = false
|
||||
tlimit = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout_seconds
|
||||
diff = timeout_seconds
|
||||
while diff > 0
|
||||
tlimit = Time.now + timeout_seconds
|
||||
while Time.now < tlimit
|
||||
if Process.waitpid pid, Process::WNOHANG
|
||||
waited = true
|
||||
break
|
||||
end
|
||||
if IO.select([io], nil, nil, diff)
|
||||
while String === io.read_nonblock(1024, exception: false)
|
||||
end
|
||||
end
|
||||
diff = tlimit - Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
||||
sleep 0.1
|
||||
end
|
||||
if !waited
|
||||
Process.kill(:KILL, pid)
|
||||
|
|
Loading…
Add table
Reference in a new issue