Document FreePort.
				
					
				
			This commit is contained in:
		
							parent
							
								
									3d1f0ded39
								
							
						
					
					
						commit
						b6b102effb
					
				@ -1,9 +1,14 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  module FreePort
 | 
			
		||||
    require "socket"
 | 
			
		||||
require "socket"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  # Helper function for finding a free port.
 | 
			
		||||
  #
 | 
			
		||||
  # @api private
 | 
			
		||||
  module FreePort
 | 
			
		||||
    # Returns a free port.
 | 
			
		||||
    # @api public
 | 
			
		||||
    def free_port
 | 
			
		||||
      server = TCPServer.new 0
 | 
			
		||||
      _, port, = server.addr
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user