lit: Use close_fds=True on UNIX, to avoid file descriptor pollution of
authorDaniel Dunbar <daniel@zuster.org>
Fri, 20 Jul 2012 18:29:34 +0000 (18:29 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 20 Jul 2012 18:29:34 +0000 (18:29 +0000)
subprocesses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160556 91177308-0d34-0410-b5e6-96231b3b80d8

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()