Module: Brillo::Helpers::ExecHelper

Included in:
Dumper::MysqlDumper, Loader, Scrubber, Transferrer::S3
Defined in:
lib/brillo/helpers/exec_helper.rb

Instance Method Summary collapse

Instance Method Details

#execute(*command) ⇒ Object



5
6
7
8
9
10
# File 'lib/brillo/helpers/exec_helper.rb', line 5

def execute *command
  command_string = Array(command).join(' ')
  log_anonymized command_string
  stdout, stderr, status = Open3.capture3 command_string
  [status.success?, stdout, stderr]
end

#execute!(*command) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/brillo/helpers/exec_helper.rb', line 12

def execute! *command
  success, stdout, stderr = execute(command)
  if success
    [success, stdout, stderr]
  else
    raise RuntimeError, "#{stdout} #{stderr}"
  end
end