mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
Close #12114: fix a potential deadlock in packaging.util._find_exe_version()
Avoid also zombi processes: Popen.communicate() calls its wait() method.
This commit is contained in:
parent
32565b6c02
commit
9904b22b78
2 changed files with 4 additions and 1 deletions
|
|
@ -74,6 +74,9 @@ def __init__(self, args, bufsize=0, executable=None,
|
|||
self.stdout = StringIO(exes[self.cmd])
|
||||
self.stderr = StringIO()
|
||||
|
||||
def communicate(self, input=None, timeout=None):
|
||||
return self.stdout.read(), self.stderr.read()
|
||||
|
||||
|
||||
class UtilTestCase(support.EnvironRestorer,
|
||||
support.TempdirManager,
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ def _find_exe_version(cmd, pattern=_RE_VERSION):
|
|||
return None
|
||||
pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
try:
|
||||
stdout, stderr = pipe.stdout.read(), pipe.stderr.read()
|
||||
stdout, stderr = pipe.communicate()
|
||||
finally:
|
||||
pipe.stdout.close()
|
||||
pipe.stderr.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue