Module: Homebrew::FreePort

Defined in:
brew/Library/Homebrew/formula_free_port.rb

Instance Method Summary collapse

Instance Method Details

#free_portObject



7
8
9
10
11
12
13
# File 'brew/Library/Homebrew/formula_free_port.rb', line 7

def free_port
  server = TCPServer.new 0
  _, port, = server.addr
  server.close

  port
end