avoid blocking in integration test on jruby
This commit is contained in:
parent
583e97110d
commit
332a7e556c
|
@ -25,6 +25,13 @@ class IntegrationTest < Test::Unit::TestCase
|
||||||
cmd.join(" ")
|
cmd.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def display_output(pipe)
|
||||||
|
out = ""
|
||||||
|
loop { out << pipe.read_nonblock(1) }
|
||||||
|
rescue
|
||||||
|
$stderr.puts command, out unless out.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def with_server
|
def with_server
|
||||||
pipe = IO.popen(command)
|
pipe = IO.popen(command)
|
||||||
error = nil
|
error = nil
|
||||||
|
@ -38,7 +45,7 @@ class IntegrationTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Timeout::Error => e
|
rescue Timeout::Error => e
|
||||||
$stderr.puts command, pipe.read if pipe
|
display_output pipe
|
||||||
raise error || e
|
raise error || e
|
||||||
ensure
|
ensure
|
||||||
Process.kill("TERM", pipe.pid) if pipe
|
Process.kill("TERM", pipe.pid) if pipe
|
||||||
|
|
Loading…
Reference in New Issue