diff options
Diffstat (limited to 'Lib/distutils/msvc9compiler.py')
-rw-r--r-- | Lib/distutils/msvc9compiler.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index 761b9ca236..6d7825df86 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"): |