class ProcessExecuter::Destinations::FileDescriptor

@api private
Handles numeric file descriptors

def self.handles?(destination)

Returns:
  • (Boolean) - true if destination is an Integer that's not stdout/stderr

Parameters:
  • destination (Object) -- the destination to check
def self.handles?(destination)
  destination.is_a?(Integer) && ![:out, 1, :err, 2].include?(destination)
end

def write(data)

Raises:
  • (SystemCallError) - if the file descriptor is invalid

Returns:
  • (Integer) - the number of bytes written

Parameters:
  • data (String) -- the data to write
def write(data)
  super
  io = ::IO.open(destination, mode: 'a', autoclose: false)
  io.write(data)
  io.close
end