Improvements to captureOutput bac125e341bf1807e8d35efde0ab22bdf9e4d8fc
authorGreg Brockman <gdb@mit.edu>
Tue, 6 Jul 2010 04:09:08 +0000 (00:09 -0400)
committerGreg Brockman <gdb@mit.edu>
Tue, 6 Jul 2010 04:09:08 +0000 (00:09 -0400)
svn path=/trunk/packages/invirt-base/; revision=3029

python/invirt/common.py

index 77b8da5..57fea45 100644 (file)
@@ -82,11 +82,12 @@ def captureOutput(popen_args, stdin_str=None, *args, **kwargs):
     if 'stdout' not in kwargs:
         kwargs['stdout'] = subprocess.PIPE
     if 'stderr' not in kwargs:
-        kwargs['stderr'] = subprocess.STDOUT
+        kwargs['stderr'] = subprocess.PIPE
     p = subprocess.Popen(popen_args, *args, **kwargs)
-    out, _ = p.communicate(stdin_str)
+    out, err = p.communicate(stdin_str)
     if p.returncode:
-        raise subprocess.CalledProcessError(p.returncode, popen_args, out)
+        raise subprocess.CalledProcessError(p.returncode, '%s, stdout: %s, stderr: %s' %
+                                            (popen_args, out, err))
     return out
 
 #