Class: ReaperMan::Utils::Process::CommandResult
- Inherits:
-
Object
- Object
- ReaperMan::Utils::Process::CommandResult
- Defined in:
- lib/reaper-man/utils/process.rb
Instance Attribute Summary collapse
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #extract_childprocess ⇒ Object
- #extract_shellout ⇒ Object
-
#initialize(result) ⇒ CommandResult
constructor
A new instance of CommandResult.
Constructor Details
#initialize(result) ⇒ CommandResult
Returns a new instance of CommandResult.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/reaper-man/utils/process.rb', line 31 def initialize(result) @original = result if result.class.ancestors.map(&:to_s).include?("ChildProcess::AbstractProcess") extract_childprocess elsif result.class.to_s == "Mixlib::ShellOut" extract_shellout else raise TypeError.new("Unknown process result type received: #{result.class}") end end |
Instance Attribute Details
#original ⇒ Object (readonly)
Returns the value of attribute original.
29 30 31 |
# File 'lib/reaper-man/utils/process.rb', line 29 def original @original end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
29 30 31 |
# File 'lib/reaper-man/utils/process.rb', line 29 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
29 30 31 |
# File 'lib/reaper-man/utils/process.rb', line 29 def stdout @stdout end |
Instance Method Details
#extract_childprocess ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/reaper-man/utils/process.rb', line 42 def extract_childprocess original.io.stdout.rewind original.io.stderr.rewind @stdout = original.io.stdout.read @stderr = original.io.stderr.read original.io.stdout.delete original.io.stderr.delete end |
#extract_shellout ⇒ Object
51 52 53 54 |
# File 'lib/reaper-man/utils/process.rb', line 51 def extract_shellout @stdout = original.stdout @stderr = original.stderr end |