summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/msvc9compiler.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-06 02:10:32 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-11-06 02:10:32 (GMT)
commit5ac6d80c02a4da1f36652e6531da3c886df1f58c (patch)
tree994056f43b6edab6491515100f808213963430a8 /Lib/distutils/msvc9compiler.py
parent25b574138353df835c94039eecb0b9edefc1dede (diff)
downloadcpython-5ac6d80c02a4da1f36652e6531da3c886df1f58c.zip
cpython-5ac6d80c02a4da1f36652e6531da3c886df1f58c.tar.gz
cpython-5ac6d80c02a4da1f36652e6531da3c886df1f58c.tar.bz2
Also close file descriptors from os.popen and subprocess.Popen
Diffstat (limited to 'Lib/distutils/msvc9compiler.py')
-rw-r--r--Lib/distutils/msvc9compiler.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
index 761b9ca..6d7825d 100644
--- a/Lib/distutils/msvc9compiler.py
+++ b/Lib/distutils/msvc9compiler.py
@@ -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"):