title: Paramiko finish process before reading all output
body: <p>I'm Trying to make a real time SSH Library, but as usually getting stuck on things, I have taken this code from <a href="https://stackoverflow.com/questions/760978/long-running-ssh-commands-in-python-paramiko-module-and-how-to-end-them">Long-running ssh commands in python paramiko module (and how to end them)</a>.
  But this code doesn't prints the whole output.</p>
  
  <p>I guess that when the while loop exits on channel.exit_status_ready() the channel still have data to read. I've been trying to fix this but the fix was not on all inputs.</p>
  
  <p>How can I make this work to print all kind of commands? </p>
  
  <pre><code>import paramiko
  import select
  
  client = paramiko.SSHClient()
  client.load_system_host_keys()
  client.connect('host.example.com')
  channel = client.get_transport().open_session()
  channel.exec_command("cd / &amp;&amp; ./test.sh")
  while True:
      if channel.exit_status_ready():
          break
      rl, wl, xl = select.select([channel], [], [], 0.0)
      if len(rl) &gt; 0:
          print channel.recv(1024)
  </code></pre>
  
  <p>test.sh:</p>
  
  <pre><code>echo 1
  wait 1
  echo 2
  wait 1
  echo 3
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1
  
  2
  
  Process finished with exit code 0
  </code></pre>
  
  <p>Thanks.</p>