From 4ec433f504bc6659889daff4097732287b4b563a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 19 Jul 2015 00:28:14 +0000 Subject: [PATCH] [LIT] Allow for executeCommand to take the stdin input. Summary: This patch allows executeCommand to pass a string to the processes stdin. Reviewers: ddunbar, jroelofs Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11332 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242631 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py index 08f7b71ae21..a4233bac7aa 100644 --- a/utils/lit/lit/util.py +++ b/utils/lit/lit/util.py @@ -48,7 +48,7 @@ def mkdir_p(path): if not path or os.path.exists(path): return - parent = os.path.dirname(path) + parent = os.path.dirname(path) if parent != path: mkdir_p(parent) @@ -158,13 +158,13 @@ def printHistogram(items, title = 'Items'): # Close extra file handles on UNIX (on Windows this cannot be done while # also redirecting input). kUseCloseFDs = not (platform.system() == 'Windows') -def executeCommand(command, cwd=None, env=None): +def executeCommand(command, cwd=None, env=None, input=None): p = subprocess.Popen(command, cwd=cwd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, close_fds=kUseCloseFDs) - out,err = p.communicate() + out,err = p.communicate(input=input) exitCode = p.wait() # Detect Ctrl-C in subprocess.