[lit] Speculatively fix PR24554 by manually closing the process handle

My theory is that somehow Python's refcounting and GC strategy isn't
closing the subprocess handle in a timely fashion.  This accesses the
private '_handle' field of the Popen object, but I see no other way to
do this. If this doesn't address the problem on the sanitizer-windows
buildbot, we can revert this change. If it does, then let's keep the
hack.

llvm-svn: 245946
This commit is contained in:
Reid Kleckner 2015-08-25 16:07:06 +00:00
parent 38b8938f40
commit 5bf2d613c9
1 changed files with 3 additions and 0 deletions

View File

@ -257,6 +257,9 @@ def executeShCmd(cmd, shenv, results):
exitCode = None exitCode = None
for i,(out,err) in enumerate(procData): for i,(out,err) in enumerate(procData):
res = procs[i].wait() res = procs[i].wait()
# On Windows, manually close the process handles.
if kIsWindows:
procs[i]._handle.Close()
# Detect Ctrl-C in subprocess. # Detect Ctrl-C in subprocess.
if res == -signal.SIGINT: if res == -signal.SIGINT:
raise KeyboardInterrupt raise KeyboardInterrupt