Class: EacRubyUtils::Envs::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/envs/process.rb

Constant Summary collapse

EXIT_CODE_KEY =
:exit_code
ERR_KEY =
:stderr
OUT_KEY =
:stdout

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Process

Returns a new instance of Process.



12
13
14
15
16
# File 'lib/eac_ruby_utils/envs/process.rb', line 12

def initialize(command)
  self.data = { command: command }
  data[OUT_KEY], data[ERR_KEY], data[EXIT_CODE_KEY] = Open3.capture3(command)
  data[EXIT_CODE_KEY] = data[EXIT_CODE_KEY].to_i
end

Instance Method Details

#to_hObject



18
19
20
# File 'lib/eac_ruby_utils/envs/process.rb', line 18

def to_h
  data.dup
end