Skip to content

Commit 0cc6a13

Browse files
committed
Place full output in exception on failed command
Fix omission in an earlier fix for failed command output so that when an error occurs all the stderr/stdout is placed into the exception
1 parent 4db61c5 commit 0cc6a13

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/sshkit/command.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ def exit_status=(new_exit_status)
9090
if options[:raise_on_non_zero_exit] && exit_status > 0
9191
message = ""
9292
message += "#{command} exit status: " + exit_status.to_s + "\n"
93-
message += "#{command} stdout: " + (stdout.strip.empty? ? "Nothing written" : stdout.strip) + "\n"
94-
95-
stderr_message = [stderr.strip, full_stderr.strip].delete_if(&:empty?).first
96-
message += "#{command} stderr: " + (stderr_message || 'Nothing written') + "\n"
93+
message += "#{command} stdout: " + (full_stdout.strip.empty? ? "Nothing written" : full_stdout.strip) + "\n"
94+
message += "#{command} stderr: " + (full_stderr.strip.empty? ? 'Nothing written' : full_stderr.strip) + "\n"
9795
raise Failed, message
9896
end
9997
end

0 commit comments

Comments
 (0)