lit: Use close_fds=True on UNIX, to avoid file descriptor pollution of
[oota-llvm.git] / utils / lit / lit / TestRunner.py
index 3004d2c713410df8047bf5516f13c25d2dc8493b..71882b76f8b95f819eb794630d8ed9313487b32b 100644 (file)
@@ -24,11 +24,15 @@ kUseCloseFDs = not kIsWindows
 kAvoidDevNull = kIsWindows
 
 def executeCommand(command, cwd=None, env=None):
+    # Close extra file handles on UNIX (on Windows this cannot be done while
+    # also redirecting input).
+    close_fds = not kIsWindows
+
     p = subprocess.Popen(command, cwd=cwd,
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
-                         env=env)
+                         env=env, close_fds=close_fds)
     out,err = p.communicate()
     exitCode = p.wait()