class SystemCat::Shell

Public Class Methods

exec(command, test: false) click to toggle source
# File lib/system_cat/shell.rb, line 6
def self.exec(command, test: false)
  puts '_______________________________________________________________________________'
  puts command

  return if test

  Kernel.exec(command)
end
exitstatus() click to toggle source
# File lib/system_cat/shell.rb, line 28
def self.exitstatus
  $CHILD_STATUS.exitstatus
end
run(command, force: false, test: false) click to toggle source
# File lib/system_cat/shell.rb, line 15
def self.run(command, force: false, test: false)
  puts '_______________________________________________________________________________'
  puts command

  return if test

  result = `#{command}`
  puts result
  raise 'Command failed' unless exitstatus.zero? || force

  return result
end