title: run long time subprocess and get stdout before the end of the execution
body: <p>I need to run a long time command and get the output in live.</p>
  <p>As an example, in the above code, I would like to get the &quot;hello&quot; stdout before waiting 20s to terminate the command:</p>
  <pre><code>import subprocess
  script = '''&quot;
  import time
  print('hello')
  time.sleep(20)
  print('OK')
  &quot;'''
  process = subprocess.Popen(['python', '-c', script], stdout=subprocess.PIPE)
  </code></pre>
  <p>Do you have any idea ? Many thanks for your help.</p>