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

Do at_exit first to make sure server is always killed, also put a select in so it fails a bit more gracefully after 10 seconds if something goes wrong with the server

This commit is contained in:
John Barker 2011-05-30 13:08:57 +08:00
parent d0cf8f8ec4
commit 13fe01c55d

View file

@ -72,10 +72,11 @@ class Capybara::Driver::Webkit
read_pipe.close
exec(server_path)
end
write_pipe.close
@server_port = ((read_pipe.first || '').match(/listening on port: (\d+)/) || [])[1]
at_exit { Process.kill("INT", @pid) }
write_pipe.close
return unless IO.select([read_pipe], nil, nil, 10)
@server_port = ((read_pipe.first || '').match(/listening on port: (\d+)/) || [])[1]
end
def connect