Permalink
Browse files

Fix killing webkit_server on JRuby

Connection now waits until webkit_server has started to
discover the pid.
  • Loading branch information...
1 parent 40a5b25 commit e2a8afb9c44e49312b26d8c6180d9f4c0831aacc @rupurt rupurt committed Jan 28, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/capybara/webkit/connection.rb
@@ -47,12 +47,12 @@ def read(length)
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 @@ def discover_port
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

0 comments on commit e2a8afb

Please sign in to comment.