class PivotalIntegration::Util::Shell

Utilities for dealing with the shell

Public Class Methods

exec(command, abort_on_failure = true) click to toggle source

Executes a command

@param [String] command the command to execute @param [Boolean] abort_on_failure whether to +Kernel#abort+ with FAIL as

the message when the command's +Status#existstatus+ is not +0+

@return [String] the result of the command

# File lib/pivotal-integration/util/shell.rb, line 27
def self.exec(command, abort_on_failure = true)
  result = `#{command}`
  if $?.exitstatus != 0 && abort_on_failure
    abort 'FAIL'
  end

  result
end