llvm.org GIT mirror llvm / 69c4cbe
lit: Fix a subtle resource usage bug when executing tests using the internal shell runner. We would inadvertently end up holding on to handles to the temporary files longer than we should have been. On Win32, where open handles lock some file operations, this caused problems in tests which would try to move temporary files around (as Clang does by default now). Many thanks to Francois Pichet for the excellent detective work on this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115040 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 8 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
177177 else:
178178 input = subprocess.PIPE
180 # Explicitly close any redirected files. We need to do this now because we
181 # need to release any handles we may have on the temporary files (important
182 # on Win32, for example). Since we have already spawned the subprocess, our
183 # handles have already been transferred so we do not need them anymore.
184 for f in opened_files:
185 f.close()
180187 # FIXME: There is probably still deadlock potential here. Yawn.
181188 procData = [None] * len(procs)
182189 procData[-1] = procs[-1].communicate()
213220 exitCode = max(exitCode, res)
214221 else:
215222 exitCode = res
217 # Explicitly close any redirected files.
218 for f in opened_files:
219 f.close()
221224 # Remove any named temporary files we created.
222225 for f in named_temp_files: