title: python subprocess popen synchronous commands
body: <p>I am trying to use popen to kick off a subprocess that calls two commands (with multiple arguements) one after the other. The second command relies on the first command running, so I was hoping to use a single subprocess to run both rather than spawning two processes and wait on the first.</p>
  
  <p>But I am running into issues because I am not sure how to give two command inputs or to seperate the command as one single object.</p>
  
  <p>Also, I am trying to avoid setting shell to true if possible.</p>
  
  <p>This is essentially, what I am trying to do:</p>
  
  <pre><code>for test in resources:
      command = [
          'pgh',
          'resource',
          'create',
          '--name', test['name'],
          '--description', test['description'],
      ]
      command2 = [
          'pgh',
          'assignment',
          'create',
          '--name', test['name'],
          '--user', test['user'],
      ]
  
  
      p = Popen(command, stdout=PIPE, stderr=PIPE)
      stdout, stderr = p.communicate()
      print(stdout)
      print(stderr)
  </code></pre>