Class: Autowow::Executor::RunWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/autowow/executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(tty_command, fail_silently: false) ⇒ RunWrapper

Returns a new instance of RunWrapper.



62
63
64
65
# File 'lib/autowow/executor.rb', line 62

def initialize(tty_command, fail_silently: false)
  @tty_command = tty_command
  @fail_silently = fail_silently
end

Instance Method Details

#run(array) ⇒ Object



67
68
69
70
71
72
73
74
# File 'lib/autowow/executor.rb', line 67

def run(array)
  begin
    @tty_command.run(*array)
  rescue TTY::Command::ExitError => e
    raise e unless @fail_silently
    exit 1
  end
end

#run!(array) ⇒ Object



76
77
78
# File 'lib/autowow/executor.rb', line 76

def run!(array)
  @tty_command.run!(*array)
end