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.



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

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

Instance Method Details

#run(array) ⇒ Object



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

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



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

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