Class: Thrust::ExecutionHelper

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

Instance Method Summary collapse

Instance Method Details

#capture_status_and_output_from_command(command, env = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/thrust/execution_helper.rb', line 7

def capture_status_and_output_from_command(command, env = {})
  env_string = ''
  env.keys.each do |key|
    env_string += "#{key}=#{env[key]} "
  end

  output = `#{env_string}#{command}`
  { success: $?.exitstatus == 0, output: output }
end

#capture_status_from_command(command, env = {}) ⇒ Object



3
4
5
# File 'lib/thrust/execution_helper.rb', line 3

def capture_status_from_command(command, env = {})
  system(env, command)
end