1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

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

View file

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