Method: ProcessExecuter::Result#stdout

Defined in:
lib/process_executer/result.rb

#stdoutString?

Return the captured stdout output

This output is only returned if the :out option value is a ProcessExecuter::MonitoredPipe.

Examples:

# Note that `ProcessExecuter.run` will wrap the given out: object in a
# ProcessExecuter::MonitoredPipe
result = ProcessExecuter.run('echo hello': out: StringIO.new)
result.stdout #=> "hello\n"

Returns:

  • (String, nil)


123
124
125
126
127
128
# File 'lib/process_executer/result.rb', line 123

def stdout
  pipe = options.stdout_redirection_value
  return nil unless pipe.is_a?(ProcessExecuter::MonitoredPipe)

  pipe.destination.string
end