lib/selenium/webdriver/common/port_prober.rb in selenium-webdriver-2.22.1 vs lib/selenium/webdriver/common/port_prober.rb in selenium-webdriver-2.22.2.rc1
- old
+ new
@@ -18,10 +18,17 @@
port
end
def self.free?(port)
- Platform.interfaces.each { |host| TCPServer.new(host, port).close }
+ Platform.interfaces.each do |host|
+ begin
+ TCPServer.new(host, port).close
+ rescue Errno::EADDRNOTAVAIL
+ $stderr.puts "could not bind to #{host}:#{port}" if $DEBUG
+ # ignored - some machines appear unable to bind to e.g. their local IP
+ end
+ end
true
rescue SocketError, Errno::EADDRINUSE
false
end