Class: Utils::ForkedChildChannel Private

Inherits:
Object
  • Object
show all
Defined in:
utils/fork.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Bidirectional channel handed to a forked child whose parent passed child_message_handler to safe_fork: request lines are written to the error pipe and each response is read back from a second pipe.

Instance Method Summary collapse

Constructor Details

#initialize(error_pipe, response_pipe) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • error_pipe (IO)
  • response_pipe (IO)


13
14
15
16
# File 'utils/fork.rb', line 13

def initialize(error_pipe, response_pipe)
  @error_pipe = error_pipe
  @response_pipe = response_pipe
end

Instance Method Details

#closevoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



34
35
36
37
# File 'utils/fork.rb', line 34

def close
  @error_pipe.close unless @error_pipe.closed?
  @response_pipe.close unless @response_pipe.closed?
end

#flushvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



24
25
26
# File 'utils/fork.rb', line 24

def flush
  @error_pipe.flush
end

#getsString?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



29
30
31
# File 'utils/fork.rb', line 29

def gets
  @response_pipe.gets
end

#puts(message) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:



19
20
21
# File 'utils/fork.rb', line 19

def puts(message)
  @error_pipe.puts message
end