New submission from STINNER Victor <victor.stin...@haypocalc.com>:

The following code does deadlock if the subprocess writes a lot of output to 
stdout and stderr:

    pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
    try:
        stdout, stderr = pipe.stdout.read(), pipe.stderr.read()
    finally:
        pipe.stdout.close()
        pipe.stderr.close()

Popen.communicate() should be used to avoid the issue.

Attached patch uses the .communicate() method and the context manager syntax 
(with).

----------
components: Library (Lib)
files: packaging_popen_communicate.patch
keywords: patch
messages: 136286
nosy: haypo, tarek
priority: normal
severity: normal
status: open
title: packaging.util._find_exe_version(): potential deadlock
versions: Python 3.3
Added file: http://bugs.python.org/file22029/packaging_popen_communicate.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12114>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to