[issue12494] subprocess: check_output() doesn't close pipes on error

STINNER Victor report at bugs.python.org
Tue Jul 5 00:13:45 CEST 2011


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

subprocess.check_output() doesn't close explicitly pipes if an error occurs. See for example issue #12493 for an example of an error on .communicate().

Attached patch uses a context manager to ensure that all pipes are always closed and that the status is read to avoid zombies.

Other subprocess functions should be fixed:
 - call() (will fix check_call)
 - getstatusoutput() (will fix getoutput): see patch attached to the issue #10197 to replace os.popen() by subprocess.Popen

----------
components: Library (Lib)
files: subprocess_check_output.patch
keywords: patch
messages: 139812
nosy: haypo
priority: normal
severity: normal
status: open
title: subprocess: check_output() doesn't close pipes on error
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file22572/subprocess_check_output.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12494>
_______________________________________


More information about the Python-bugs-list mailing list