redirect subprocess stderr to stdout

This commit is contained in:
David Zuelke
2016-02-16 22:24:37 +01:00
parent c27f8e6beb
commit c669c195db
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -128,8 +128,7 @@ class Formula(object):
if p.returncode != 0:
print
print 'ERROR: An error occurred:'
pipe(p.stderr, sys.stderr, indent=True)
print 'ERROR: An error occurred.'
exit(1)
+3 -3
View File
@@ -3,7 +3,7 @@
import os
import re
import tarfile
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE, STDOUT
def iter_marker_lines(marker, formula, strip=True):
"""Extracts any markers from a given formula."""
@@ -27,8 +27,8 @@ def mkdir_p(path):
def process(cmd, cwd=None):
"""A simple wrapper around the subprocess module."""
p = Popen(cmd, cwd=cwd, shell=False, stdout=PIPE, stderr=PIPE)
"""A simple wrapper around the subprocess module; stderr is redirected to stdout."""
p = Popen(cmd, cwd=cwd, shell=False, stdout=PIPE, stderr=STDOUT)
return p