Method: Warg::Host::CommandOutcome#failure_summary

Defined in:
lib/warg.rb

#failure_summaryObject



1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/warg.rb', line 1054

def failure_summary
  case failure_reason
  when :exit_signal, :nonzero_exit_status
    adjusted_stdout, adjusted_stderr = [stdout, stderr].map do |output|
      adjusted = output.each_line.map { |line| line.prepend("  ") }.join.chomp

      if adjusted.empty?
        adjusted = "(empty)"
      end

      adjusted
    end

    <<~OUTPUT
      STDOUT: #{adjusted_stdout}
      STDERR: #{adjusted_stderr}
    OUTPUT
  when :connection_error
    <<~OUTPUT
      Connection failed:
        Code: #{connection_error_code}
        Reason: #{connection_error_reason}
    OUTPUT
  end
end