Module: Kernel

Defined in:
lib/Kernel/run.rb

Instance Method Summary collapse

Instance Method Details

#run(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/Kernel/run.rb', line 27

def run(*args)
  options = args.extract_options!
  command = args
  if options[:show] && !options[:dry_run]
    puts command.join(' ')
  elsif options[:show] && options[:dry_run]
    puts "DRY RUN *** #{command.join(' ')} *** DRY RUN"
  end
  unless options[:dry_run]
    system(*command)
    if !$?.success? && !options[:dont_raise]
      raise "#{command.inspect} failed to exit cleanly."
    end
  end
end