title: "subprocess.Popen" - checking for success and errors
body: <p>I want to check if a subprocess has finished execution successfully or failed. Currently I have come up with a solution but I am not sure if it is correct and reliable. Is it guaranteed that every process outputs its errors only to stderr respectfully to <code>stdout</code>:</p>
  
  <p>Note: I am not interested in just redirecting/printing out the output. That I know already how to do.</p>
  
  <pre><code>pipe = subprocess.Popen(command,
                                  stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE,
                                  universal_newlines=True)
  
  if "" == pipe.stdout.readline():
      print("Success")
      self.isCommandExectutionSuccessful = True
  
  if not "" == pipe.stderr.readline():
      print("Error")
      self.isCommandExectutionSuccessful = True
  </code></pre>
  
  <p>alternatively:</p>
  
  <pre><code>   if "" == pipe.stdout.readline():
         print("Success")
         self.isCommandExectutionSuccessful = True
     else:
         print("Error")
         self.isCommandExectutionSuccessful = False
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>   if not "" == pipe.stderr.readline():
         print("Success")
         self.isCommandExectutionSuccessful = True
     else:
         print("Error")
         self.isCommandExectutionSuccessful = False
  </code></pre>