Fix some lit test ResourceWarnings on Windows

When running LLDB lit tests on Windows, the system selects a debug version
of Python, which was issuing lots of ResourceWarnings about files that
weren't closed.  There are two kinds of them, and each test triggered one
of each.

This patch fixes one kind by ensuring TestRunner explicitly close the
temporary files created for routing stderr.  This is important on Windows
but has no net effect on Posix systems.

The remaining ResourceWarnings are more elusive; the bug may lie in
the Python library subprocess.py, and it may be Windows-specific.

Differential Revision: https://reviews.llvm.org/D63102

llvm-svn: 363700
This commit is contained in:
Adrian McCarthy 2019-06-18 16:36:57 +00:00
parent 3559d2224e
commit 46e6e13298
1 changed files with 1 additions and 0 deletions

View File

@ -991,6 +991,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
for i,f in stderrTempFiles: for i,f in stderrTempFiles:
f.seek(0, 0) f.seek(0, 0)
procData[i] = (procData[i][0], f.read()) procData[i] = (procData[i][0], f.read())
f.close()
exitCode = None exitCode = None
for i,(out,err) in enumerate(procData): for i,(out,err) in enumerate(procData):