title: Comparing stdout and breaking out of loop to close a SSH connection
body: <p>I am storing the log of a command executed over SSH to a file (logfile here):</p>
  
  <pre><code>while True:
   try:
    rl, wl, xl = select.select([channel],[],[],0.0) 
    if len(rl) &gt; 0:
  
      stdout_data.append(channel.recv(65536))
      #print channel.recv(1024)
      logfile.write(''.join(stdout_data))
      logfile.flush()
  </code></pre>
  
  <p>Is it possible to read the data (preferably in a streaming method) and set a trigger based on a word (like 'Continue') to exit this process? I want to close the connection when I read 'Continuing'. </p>
  
  <p>I am trying this with no result so far:</p>
  
  <pre><code> elif(stdout_data == 'Continuing.'):
     break
  </code></pre>