[llvm-commits] [llvm] r100032 - /llvm/trunk/utils/lit/lit/TestRunner.py
Daniel Dunbar
daniel at zuster.org
Wed Mar 31 11:48:43 PDT 2010
Author: ddunbar
Date: Wed Mar 31 13:48:43 2010
New Revision: 100032
URL: http://llvm.org/viewvc/llvm-project?rev=100032&view=rev
Log:
lit: Make sure to close any files we open as part of redirection.
PR6753.
Modified:
llvm/trunk/utils/lit/lit/TestRunner.py
Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=100032&r1=100031&r2=100032&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Wed Mar 31 13:48:43 2010
@@ -63,6 +63,7 @@
procs = []
input = subprocess.PIPE
stderrTempFiles = []
+ opened_files = []
# To avoid deadlock, we use a single stderr stream for piped
# output. This is null until we have seen some output using
# stderr.
@@ -115,6 +116,7 @@
# Workaround a Win32 and/or subprocess bug when appending.
if r[1] == 'a':
r[2].seek(0, 2)
+ opened_files.append(r[2])
result = r[2]
final_redirects.append(result)
@@ -176,7 +178,7 @@
else:
err = ''
procData[i] = (out,err)
-
+
# Read stderr out of the temp files.
for i,f in stderrTempFiles:
f.seek(0, 0)
@@ -199,6 +201,10 @@
else:
exitCode = res
+ # Explicitly close any redirected files.
+ for f in opened_files:
+ f.close()
+
if cmd.negate:
exitCode = not exitCode
More information about the llvm-commits
mailing list