title: How to get exit status with Ruby's Net::SSH library?
body: <p>I have a snippet of code, simply trying to execute a script on a remote server, in the event that it fails, I'd like to make a follow-up call, imagine this:</p>
  
  <pre><code>require 'rubygems'
  require 'net/ssh'
  require 'etc'
  
  server = 'localhost'
  
  Net::SSH.start(server, Etc.getlogin) do |ssh|
    puts (ssh.exec("true")  ? 'Exit Success' : "Exit Failure")
    puts (ssh.exec("false") ? 'Exit Success' : "Exit Failure")  
  end
  </code></pre>
  
  <p>I would expect (ignoring that stdout and stderr are printed in my contrived example) - but first line should exit with <code>0</code> which I would expect Ruby would interperate as <code>false</code> and display "Exit Failure" (sure, so the logic is wrong, the ternary needs to be flipped) - but the second line should exit with the opposite status, and it doesn't.</p>
  
  <p>I can't even find anything in the documentation about how to do this, and I'm a little worried that I might be doing it wrong?!</p>