title: python subprocess: order of output changes when using subprocess.PIPE
body: <p>When I write a python script called <code>outer.py</code> containing</p>
  
  <pre><code>p = subprocess.Popen(['./inner.py'])
  print('Called inner.py without options, waiting for process...')
  p.wait()
  print('Waited for inner.py without options')
  
  p = subprocess.Popen(['./inner.py'], stdout=subprocess.PIPE)
  print('Called inner.py with PIPE, communicating...')
  b_out, b_err = p.communicate()
  out = b_out.decode('utf8')
  print('out is "{}"'.format(out))
  </code></pre>
  
  <p>And an <code>inner.py</code> containing</p>
  
  <pre><code>print("inner: Echoing Hallo")
  p = subprocess.Popen(['echo', 'hallo'])
  print("inner: Waiting for Echo to finish...")
  p.wait()
  print("inner: Waited for Echo")
  </code></pre>
  
  <p>I get the following when calling <code>outer.py</code> from a terminal:</p>
  
  <pre><code>Called inner.py without options, waiting for process...
  inner: Echoing Hallo
  inner: Waiting for Echo to finish...
  hallo
  inner: Waited for Echo
  Waited for inner.py without options
  
  Called inner.py with PIPE, communicating...
  out is "hallo
  inner: Echoing Hallo
  inner: Waiting for Echo to finish...
  inner: Waited for Echo
  "
  </code></pre>
  
  <p>Why, when calling <code>inner.py</code> with <code>stdout=subprocess.PIPE</code>, does the "hallo" appear before the "inner: Echoing Hallo" in the captured output?</p>