run-tests: self-test on Windows needs binary streams stable
authorMatt Mackall <mpm@selenic.com>
Tue, 12 Aug 2014 11:02:30 -0500
branchstable
changeset 22120 68a7ef4311ce
parent 22106 e5dfa8689cf0
child 22121 706b91f6dd0e
run-tests: self-test on Windows needs binary streams
tests/run-tests.py
--- a/tests/run-tests.py	Tue Aug 12 02:40:42 2014 -0500
+++ b/tests/run-tests.py	Tue Aug 12 11:02:30 2014 -0500
@@ -1820,4 +1820,13 @@
 
 if __name__ == '__main__':
     runner = TestRunner()
+
+    try:
+        import msvcrt
+        msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+        msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+        msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+    except ImportError:
+        pass
+
     sys.exit(runner.run(sys.argv[1:]))