[llvm] r242631 - [LIT] Allow for executeCommand to take the stdin input.

Eric Fiselier eric at efcs.ca
Sat Jul 18 17:28:14 PDT 2015


Author: ericwf
Date: Sat Jul 18 19:28:14 2015
New Revision: 242631

URL: http://llvm.org/viewvc/llvm-project?rev=242631&view=rev
Log:
[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

Modified:
    llvm/trunk/utils/lit/lit/util.py

Modified: llvm/trunk/utils/lit/lit/util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/util.py?rev=242631&r1=242630&r2=242631&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/util.py (original)
+++ llvm/trunk/utils/lit/lit/util.py Sat Jul 18 19:28:14 2015
@@ -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.





More information about the llvm-commits mailing list