Class: Imagemaster3000::Utils::CommandExecutioner

Inherits:
Object
  • Object
show all
Defined in:
lib/imagemaster3000/utils/command_executioner.rb

Class Method Summary collapse

Class Method Details

.execute(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/imagemaster3000/utils/command_executioner.rb', line 7

def execute(*args)
  command = Mixlib::ShellOut.new(*args)
  logger.debug "Executing command: #{command.command.inspect}"
  command.run_command

  if command.error?
    raise Imagemaster3000::Errors::CommandExecutionError, "Command #{command.command.inspect} terminated with an error: " \
                                                      "#{command.stderr}"
  end

  command.stdout
end