Fix killing webkit_server on JRuby

Connection now waits until webkit_server has started to
discover the pid.
This commit is contained in:
Alex Kwiatkowski 2014-01-28 13:54:15 -05:00
parent 40a5b251d2
commit e2a8afb9c4
1 changed files with 6 additions and 2 deletions

View File

@ -47,12 +47,12 @@ module Capybara::Webkit
def start_server
open_pipe
discover_port
discover_pid
forward_output_in_background_thread
end
def open_pipe
_, @pipe_stdout, @pipe_stderr, wait_thr = Open3.popen3(SERVER_PATH)
@pid = wait_thr[:pid]
_, @pipe_stdout, @pipe_stderr, @wait_thr = Open3.popen3(SERVER_PATH)
register_shutdown_hook
end
@ -81,6 +81,10 @@ module Capybara::Webkit
end
end
def discover_pid
@pid = @wait_thr[:pid]
end
def forward_output_in_background_thread
Thread.new do
Thread.current.abort_on_exception = true