Class: GitPivotalTrackerIntegration::Util::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/git-pivotal-tracker-integration/util/shell.rb

Overview

Utilities for dealing with the shell

Class Method Summary collapse

Class Method Details

.exec(command, abort_on_failure = true) ⇒ String

Executes a command

Parameters:

  • command (String)

    the command to execute

  • abort_on_failure (Boolean) (defaults to: true)

    whether to Kernel#abort with FAIL as the message when the command’s Status#existstatus is not 0

Returns:

  • (String)

    the result of the command



28
29
30
31
32
33
34
35
# File 'lib/git-pivotal-tracker-integration/util/shell.rb', line 28

def self.exec(command, abort_on_failure = true)
  result = `#{command}`
  if $?.exitstatus != 0 && abort_on_failure
    abort "FAIL on command:#{command}"
  end

  result
end