Module: Phase::Util::Shell

Includes:
Console
Included in:
Deploy::Build
Defined in:
lib/phase/util/shell.rb

Instance Method Summary collapse

Methods included from Console

#ask, #fail, #log

Instance Method Details

#shell(*args) {|$?| ... } ⇒ Object

Yields:

  • ($?)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/phase/util/shell.rb', line 6

def shell(*args)
  options = args.extract_options!
  options.reverse_merge!({
    allow_failure: false
  })

  log "running: #{args.join(' ')}"
  succeeded = !!system(*args) || options[:allow_failure]

  yield $? unless succeeded

  succeeded
end