Class: Exeggutor::ProcessResult

Inherits:
Object
  • Object
show all
Defined in:
lib/exeggutor.rb

Overview

Represents the result of a process execution.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:, exit_code:, pid:) ⇒ ProcessResult

Returns a new instance of ProcessResult.



107
108
109
110
111
112
# File 'lib/exeggutor.rb', line 107

def initialize(stdout:, stderr:, exit_code:, pid:)
  @stdout = stdout
  @stderr = stderr
  @exit_code = exit_code
  @pid = pid
end

Instance Attribute Details

#exit_codeInteger (readonly)

The exit code of the process.

Returns:

  • (Integer)

    the current value of exit_code



103
104
105
# File 'lib/exeggutor.rb', line 103

def exit_code
  @exit_code
end

#pidObject (readonly)

Returns the value of attribute pid.



104
105
106
# File 'lib/exeggutor.rb', line 104

def pid
  @pid
end

#stderrString (readonly)

The standard error of the process.

Returns:

  • (String)

    the current value of stderr



103
104
105
# File 'lib/exeggutor.rb', line 103

def stderr
  @stderr
end

#stdoutString (readonly)

The standard output of the process.

Returns:

  • (String)

    the current value of stdout



103
104
105
# File 'lib/exeggutor.rb', line 103

def stdout
  @stdout
end

Instance Method Details

#success?Boolean

Checks if the process was successful.

Returns:

  • (Boolean)

    True if the exit code is 0, otherwise false.



117
118
119
# File 'lib/exeggutor.rb', line 117

def success?
  exit_code == 0
end