Module: Rails::Diff::Shell

Extended by:
Shell
Included in:
Shell
Defined in:
lib/rails/diff/shell.rb

Instance Method Summary collapse

Instance Method Details

#run!(*cmd, logger:, abort: true) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rails/diff/shell.rb', line 10

def run!(*cmd, logger:, abort: true)
  _, stderr, status = Open3.capture3(*cmd)
  logger.debug(cmd.join(" "))
  if status.success?
    true
  elsif abort
    logger.error("Command failed:", cmd.join(" "))
    abort stderr
  else
    false
  end
end