Skip to content

Commit

Permalink
Added wait_for_socket_close definition and call in order to ensure th…
Browse files Browse the repository at this point in the history
…at the app server we've started has exited.
  • Loading branch information
ess committed Aug 31, 2010
1 parent 6e7f80e commit bd0d7d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/webrat/selenium/application_servers/base.rb
Expand Up @@ -15,6 +15,7 @@ def boot
def stop_at_exit
at_exit do
stop
wait_for_socket_close
end
end

Expand All @@ -34,6 +35,17 @@ def wait_for_socket
rescue SocketError
fail
end

def wait_for_socket_close
silence_stream(STDOUT) do
TCPSocket.wait_for_service_termination_with_timeout \
:host => "0.0.0.0",
:port => Webrat.configuration.application_port.to_i,
:timeout => 30
end
rescue SocketError
true
end

def prepare_pid_file(file_path, pid_file_name)
FileUtils.mkdir_p File.expand_path(file_path)
Expand Down

0 comments on commit bd0d7d4

Please sign in to comment.