Fix test harness where blocking could occur on IO read.

We had issues with the CI where some tests would sometimes hang
on cleanup when it would call VBoxManage, even with a timeout.
My only assumption is that this is happening as it waits on `readline`,
so we do a `read_nonblock` which will help immensely.
This commit is contained in:
Mitchell Hashimoto 2011-11-24 14:13:22 -07:00
parent 1eb3845405
commit 87767e24d0
1 changed files with 5 additions and 3 deletions

View File

@ -98,12 +98,14 @@ module Acceptance
if !readers.empty?
begin
readers.each do |r|
data = r.readline
data = r.read_nonblock(1024)
io_data[r] += data
io_name = r == stdout ? "stdout" : "stderr"
@logger.debug("[#{io_name}] #{data.chomp}")
@logger.debug(data)
yield io_name.to_sym, data if block_given?
end
rescue IO::WaitReadable
# This just means the IO wasn't actually ready and we should
# wait some more. So we just let this pass through.
rescue EOFError
# Process exited, so break out of this while loop
break