[PATCH] D11332: [LIT] Allow for executeCommand to take the stdin input.

Eric Fiselier eric at efcs.ca
Sat Jul 18 15:44:28 PDT 2015


EricWF created this revision.
EricWF added reviewers: ddunbar, jroelofs.
EricWF added a subscriber: llvm-commits.

This patch allows executeCommand to pass a string to the processes stdin.

http://reviews.llvm.org/D11332

Files:
  utils/lit/lit/util.py

Index: utils/lit/lit/util.py
===================================================================
--- utils/lit/lit/util.py
+++ utils/lit/lit/util.py
@@ -48,7 +48,7 @@
     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 @@
 # 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11332.30094.patch
Type: text/x-patch
Size: 1028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150718/e608a193/attachment.bin>


More information about the llvm-commits mailing list