diff tests/md5sum.py @ 7080:a6477aa893b8

tests: Windows compatibility fixes - printenv.py, md5sum.py, simplemerge, test-archive, test-merge1, test-merge-symlinks: set standard streams to binary mode - test-encode: replace "gunzip" by "gzip -d" - test-hup: requires fifo
author Patrick Mezard <pmezard@gmail.com>
date Sun, 12 Oct 2008 19:11:59 +0200
parents ac0bcd951c2c
children 1ffeeb91c55d
line wrap: on
line diff
--- a/tests/md5sum.py	Sun Oct 12 19:11:56 2008 +0200
+++ b/tests/md5sum.py	Sun Oct 12 19:11:59 2008 +0200
@@ -6,13 +6,20 @@
 # of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is
 # GPL-compatible.
 
-import sys
+import sys, os
 
 try:
     from hashlib import md5
 except ImportError:
     from md5 import md5
 
+try:
+    import msvcrt
+    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+except ImportError:
+    pass
+
 for filename in sys.argv[1:]:
     try:
         fp = open(filename, 'rb')