Module: Nexoform::Sh

Defined in:
lib/nexoform/shell.rb

Class Method Summary collapse

Class Method Details

.run_command(command, print_stdout = false) ⇒ Object



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

def self.run_command(command, print_stdout = false)
  stdout = `#{command}`
  puts stdout if print_stdout
  OpenStruct.new(
    success?: $?.exitstatus.zero?,
    exitstatus: $?.exitstatus,
    stdout: stdout
  )
end