Skip to content

Commit

Permalink
Do at_exit first to make sure server is always killed, also put a sel…
Browse files Browse the repository at this point in the history
…ect in so it fails a bit more gracefully after 10 seconds if something goes wrong with the server
  • Loading branch information
j16r committed May 30, 2011
1 parent d0cf8f8 commit 13fe01c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/capybara/driver/webkit/browser.rb
Expand Up @@ -72,10 +72,11 @@ def start_server
read_pipe.close
exec(server_path)
end
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]

at_exit { Process.kill("INT", @pid) }
end

def connect
Expand Down

0 comments on commit 13fe01c

Please sign in to comment.