mirror of
https://github.com/python/cpython.git
synced 2025-07-25 12:14:38 +00:00
Also close file descriptors from os.popen and subprocess.Popen
This commit is contained in:
parent
25b5741383
commit
5ac6d80c02
2 changed files with 25 additions and 19 deletions
|
@ -263,10 +263,12 @@ def query_vcvarsall(version, arch="x86"):
|
|||
popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
||||
stdout, stderr = popen.communicate()
|
||||
if popen.wait() != 0:
|
||||
raise DistutilsPlatformError(stderr.decode("mbcs"))
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
if popen.wait() != 0:
|
||||
raise DistutilsPlatformError(stderr.decode("mbcs"))
|
||||
finally:
|
||||
popen.close()
|
||||
|
||||
stdout = stdout.decode("mbcs")
|
||||
for line in stdout.split("\n"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue