def system_exit_on_error(command, options={})
      options = {'print_command' => true}.merge(string_keys(options))
      output command if options['print_command'] || @debug
      command_output = system_command(command)
      output command_output if @debug
      unless last_process.success?
        result = options['on_failure'].call(command, options) if options['on_failure'].is_a?(Proc)
        return true if result
        output options['failure_message'] || command_output
        return exit(last_process.exitstatus)
      end
      options['on_success'].call(command, options) if options['on_success'].is_a?(Proc)
      true
    end
def system_exit_on_error(command, options={})
      options = {'print_command' => true}.merge(string_keys(options))
      output command if options['print_command'] || @debug
      command_output = system_command(command)
      output command_output if @debug
      unless last_process.success?
        result = options['on_failure'].call(command, options) if options['on_failure'].is_a?(Proc)
        return true if result
        output options['failure_message'] || command_output
        return exit(last_process.exitstatus)
      end
      options['on_success'].call(command, options) if options['on_success'].is_a?(Proc)
      true
    end
Run system commands and if not successful exit and print out an error
 message. Default behavior is to print output of a command when it does
 not return success.

 command - the system command you want to execute
 options - 'error_message' - a message to print when command is not successful
           'print_command' - displays the command being run
           'failure_callback' - Proc to execute when the command fails. If a callback returns
             true then it will avoid
           'on_success' - Proc to execute when the command is successful

 returns only true, will perform exit() when not successful