[PATCH 1 of 1] 'hg serve --stdio' needs stdio set to binary underWindows

Maquelin, Olivier olivier.maquelin at intel.com
Thu Sep 29 09:50:23 CDT 2005


# HG changeset patch
# User olivier.maquelin at intel.com
# Node ID 8db3606a4e5c3170c560c9afc987f4bc574c2e18
# Parent  51ac9a79f3e5bda2c734106a7a221376f1331066
'hg serve --stdio' needs stdio set to binary under Windows.

diff -r 51ac9a79f3e5 -r 8db3606a4e5c mercurial/commands.py
--- a/mercurial/commands.py	Tue Sep 27 18:30:54 2005 -0700
+++ b/mercurial/commands.py	Wed Sep 28 08:47:29 2005 -0700
@@ -1486,6 +1486,13 @@
     if opts["stdio"]:
         fin, fout = sys.stdin, sys.stdout
         sys.stdout = sys.stderr
+
+        try: # Windows needs stdio set for binary mode.
+            import msvcrt
+            msvcrt.setmode(fin.fileno(), os.O_BINARY)
+            msvcrt.setmode(fout.fileno(), os.O_BINARY)
+        except ImportError:
+            pass
 
         def getarg():
             argline = fin.readline()[:-1]



More information about the Mercurial mailing list