class ProcessExecuter::Result
@api public
* ‘timed_out?`: true if the process timed out
* `stderr`: the captured stderr output
* `stdout`: the captured stdout output
* `elapsed_time`: the secs the command ran
* `options`: the options that were used to spawn the process
* `command`: the command that was used to spawn the process
A decorator for Process::Status that adds the following attributes:
def initialize(status, command:, options:, timed_out:, elapsed_time:)
- Api: - public
Parameters:
-
elapsed_time
(Numeric
) -- the secs the command ran -
timed_out
(Boolean
) -- true if the process timed out -
options
(ProcessExecuter::Options
) -- the options that were used to spawn the process -
command
(Array
) -- the command that was used to spawn the process -
status
(Process::Status
) -- the status to delegate to
def initialize(status, command:, options:, timed_out:, elapsed_time:) super(status) @command = command @options = options @timed_out = timed_out @elapsed_time = elapsed_time end
def stderr
-
(String, nil)
-
def stderr Array(options.err).each do |pipe| next unless pipe.is_a?(ProcessExecuter::MonitoredPipe) pipe.writers.each do |writer| return writer.string if writer.respond_to?(:string) end end nil end
def stdout
-
(String, nil)
-
def stdout Array(options.out).each do |pipe| next unless pipe.is_a?(ProcessExecuter::MonitoredPipe) pipe.writers.each do |writer| return writer.string if writer.respond_to?(:string) end end nil end
def success?
-
(true, nil)
-
def success? return nil if timed_out? # rubocop:disable Style/ReturnNilInPredicateMethodDefinition super end
def timed_out? = @timed_out
-
(Boolean)
-
def timed_out? = @timed_out
def to_s
-
(String)
-
def to_s "#{super}#{timed_out? ? " timed out after #{options.timeout_after}s" : ''}" end