title: Getting realtime and full output using subprocess
body: <p>I am trying to get the realtime output as well as the full output. I have the below code that outputs the realtime output of the command very well but I also need to capture the full output which can then be sent in an email without interrupting the realtime output</p>
  
  <pre><code>backup = subprocess.Popen("rsync ....", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  for line in iter(backup.stdout.readline, b''):
     print("&gt;&gt;&gt; " + line.rstrip())
  </code></pre>
  
  <p>I have tried adding the following but it causes the realtime output not to display</p>
  
  <pre><code>output = backup.stdout.read()
  </code></pre>