title: Subprocess will not run any commands after initial args in Popen constructor, even after flushing all pipes
body: <p>I am using Python 3.8.9 and need to create a subprocess that I can send multiple commands to. My code is as follows:</p>
  <pre class="lang-py prettyprint-override"><code>sub1=subprocess.Popen('echo a\n', shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
  sub1.stdout.readline()
  sub1.stdout.flush()
  sub1.stdin.flush()
  sub1.stderr.flush()
  sub1.stdin.write('echo b\n')
  sub1.stdout.readline()
  </code></pre>
  <p>And this prints</p>
  <pre class="lang-py prettyprint-override"><code>'a\n'
  7
  ''
  </code></pre>
  <p>while it should print</p>
  <pre class="lang-py prettyprint-override"><code>'a\n'
  7
  'b\n'
  </code></pre>
  <p>I don't understand why it seemingly isn't executing the second command, or quite frankly giving any output at all after running another command. I heard some people saying that .write is having issues in Python 3 but that .communicate does work, so I tried that but to no avail</p>
  <pre class="lang-py prettyprint-override"><code>sub1=subprocess.Popen('echo a\n', shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
  sub1.stdout.readline()
  sub1.stdout.flush()
  sub1.stdin.flush()
  sub1.stderr.flush()
  out, err= sub1.communicate(input='echo b\n', timeout=15)
  print(out)
  print(err)
  </code></pre>
  <p>Both out and err printed</p>
  <pre class="lang-py prettyprint-override"><code>''
  </code></pre>
  <p>I couldn't find any extant question that covers this issue so I hope it is something that can be simply resolved.</p>