Class: SSHKit::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/sshkit/monkeypatches.rb

Instance Method Summary collapse

Instance Method Details

#exit_status=(new_exit_status) ⇒ Object

returns the full contents of stdout when an error occurs rather than just the first line (needed for chef debugging)



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/sshkit/monkeypatches.rb', line 4

def exit_status=(new_exit_status)
  @finished_at = Time.now
  @exit_status = new_exit_status

  if options[:raise_on_non_zero_exit] && exit_status > 0
    message = ""
    message += "#{command} exit status: " + exit_status.to_s + "\n"
    message += "#{command} stdout: " + (full_stdout.strip || "Nothing written") + "\n"
    message += "#{command} stderr: " + (full_stderr.strip || 'Nothing written') + "\n\n"
    raise Failed, message
  end
end