[PATCH] D16000: Add "/dev/console" as a special file name to lit

Yunzhong Gao via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 13:44:40 PST 2016


ygao updated this revision to Diff 45440.
ygao added a comment.

@delcypher,

You are right, and I like your idea of using a special device file on Windows for accessing the console. Thanks!


http://reviews.llvm.org/D16000

Files:
  utils/lit/lit/TestRunner.py

Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -245,6 +245,10 @@
                 if r[2] is None:
                     if kAvoidDevNull and r[0] == '/dev/null':
                         r[2] = tempfile.TemporaryFile(mode=r[1])
+                    elif kIsWindows and r[0] == '/dev/tty':
+                        # Simulate /dev/tty on Windows.
+                        # "CON:" is a special filename for the console.
+                        r[2] = open("CON:", r[1])
                     else:
                         # Make sure relative paths are relative to the cwd.
                         redir_filename = os.path.join(cmd_shenv.cwd, r[0])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16000.45440.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160120/8ada0848/attachment.bin>


More information about the llvm-commits mailing list