lib/selenium/webdriver/phantomjs/service.rb in selenium-webdriver-2.52.0 vs lib/selenium/webdriver/phantomjs/service.rb in selenium-webdriver-2.53.0
- old
+ new
@@ -73,16 +73,12 @@
http.open_timeout = STOP_TIMEOUT / 2
http.read_timeout = STOP_TIMEOUT / 2
http.get("/shutdown")
end
-
- @process.poll_for_exit STOP_TIMEOUT
- rescue ChildProcess::TimeoutError
- # ok, force quit
- @process.stop STOP_TIMEOUT
-
+ ensure
+ stop_process
if Platform.jruby? && !$DEBUG
@process.io.close rescue nil
end
end
@@ -106,9 +102,15 @@
# apparently we need to read the output for phantomjs to work on jruby
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
end
@process.start
+ end
+
+ def stop_process
+ @process.poll_for_exit STOP_TIMEOUT
+ rescue ChildProcess::TimeoutError
+ @process.stop STOP_TIMEOUT
end
def connect_until_stable
socket_poller = SocketPoller.new @host, @port, START_TIMEOUT