find an open port in a more robust way
This commit is contained in:
parent
dc843e8812
commit
8cb9f865f4
|
@ -2,7 +2,7 @@ require 'socket'
|
|||
require 'erb'
|
||||
|
||||
module Jasmine
|
||||
# this seemingly-over-complex method is necessary to get it to work on at least some machines
|
||||
# this seemingly-over-complex method is necessary to get an open port on at least some of our Macs
|
||||
def self.open_socket_on_unused_port
|
||||
infos = Socket::getaddrinfo("localhost", nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
|
||||
families = Hash[*infos.collect { |af, *_| af }.uniq.zip([]).flatten]
|
||||
|
|
Loading…
Reference in New Issue