From 332a7e556cc1f4d156a78975feeb59e437834895 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Sun, 6 Nov 2011 09:17:42 -0300 Subject: [PATCH] avoid blocking in integration test on jruby --- test/integration_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/integration_test.rb b/test/integration_test.rb index fab592c7..d3b3808e 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -25,6 +25,13 @@ class IntegrationTest < Test::Unit::TestCase cmd.join(" ") end + def display_output(pipe) + out = "" + loop { out << pipe.read_nonblock(1) } + rescue + $stderr.puts command, out unless out.empty? + end + def with_server pipe = IO.popen(command) error = nil @@ -38,7 +45,7 @@ class IntegrationTest < Test::Unit::TestCase end end rescue Timeout::Error => e - $stderr.puts command, pipe.read if pipe + display_output pipe raise error || e ensure Process.kill("TERM", pipe.pid) if pipe