Skip to content
Browse files

use #system if Process.kill is not supported, use KILL instead of TER…

…M if something went wrong
  • Loading branch information...
1 parent bb10d7a commit 7cdc7d114f5e3f92e09938c1957ccdbc0d233cde @rkh rkh committed Nov 6, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 test/integration_test.rb
View
10 test/integration_test.rb
@@ -32,6 +32,12 @@ def display_output(pipe)
$stderr.puts command, out unless out.empty?
end
+ def kill(pid, signal = "TERM")
+ Process.kill(signal, pid)
+ rescue NotImplementedError
+ system "kill -s #{signal} #{pid}"
+ end
+
def with_server
pipe = IO.popen(command)
error = nil
@@ -44,11 +50,11 @@ def with_server
retry
end
end
+ kill(pipe.pid) if pipe
rescue Timeout::Error => e
display_output pipe
+ kill(pipe.pid, "KILL") if pipe
raise error || e
- ensure
- Process.kill("TERM", pipe.pid) if pipe
end
it 'starts a top level application' do

0 comments on commit 7cdc7d1

Please sign in to comment.
Something went wrong with that request. Please try again.