Merged revisions 87695 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87695 | antoine.pitrou | 2011-01-03 19:23:55 +0100 (lun., 03 janv. 2011) | 5 lines

  Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
  file descriptors (0, 1, 2) are closed in the parent process.  Initial
  patch by Ross Lagerwall.
........
This commit is contained in:
Antoine Pitrou 2011-01-03 18:45:09 +00:00
parent 513c4f8fdd
commit 91ce0d933c
4 changed files with 89 additions and 16 deletions

View file

@ -1219,3 +1219,13 @@ def args_from_interpreter_flags():
if v > 0:
args.append('-' + opt * v)
return args
def strip_python_stderr(stderr):
"""Strip the stderr of a Python process from potential debug output
emitted by the interpreter.
This will typically be run on the result of the communicate() method
of a subprocess.Popen object.
"""
stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip()
return stderr