title: Python getstatusoutput replacement not returning full output
body: <p>I came across this great replacment for the <code>getstatusoutput()</code> function in Python 2.* which works equally well on Unix and Windows.  However, I think there is something wrong with the way the <code>output</code> is constructed.  It only returns the last line of the output, but I can't figure out why.  Any help would be awesome.</p>
  
  <pre><code>def getstatusoutput(cmd):
      """Return (status, output) of executing cmd in a shell."""
      """This new implementation should work on all platforms."""
      import subprocess
      pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, universal_newlines=True)
      output = "".join(pipe.stdout.readlines())
      sts = pipe.returncode
      if sts is None: sts = 0
      return sts, output
  </code></pre>