lit: Use close_fds=True on UNIX, to avoid file descriptor pollution of

subprocesses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160556 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2012-07-20 18:29:34 +00:00
parent dd2fb6c10b
commit b1a4642796

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