[PATCH] tests: apply binary mode to output in seq.py
Matt Harbison
mharbison72 at gmail.com
Sun Dec 2 02:47:01 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1543718568 18000
# Sat Dec 01 21:42:48 2018 -0500
# Node ID 857609d4099542c276c84741d4f894f13cde4455
# Parent 104266c4afd3519ddd09e3718590af5062a85b70
tests: apply binary mode to output in seq.py
I noticed this when playing with running tests using WSL, and iterating over the
output yielded '0\r', '1\r',... Most of the other *.py tools do this, and `seq`
on MSYS lacks '\r' in the output, so this is more consistent.
diff --git a/tests/seq.py b/tests/seq.py
--- a/tests/seq.py
+++ b/tests/seq.py
@@ -8,8 +8,17 @@
# seq START STEP STOP [START, STOP] stepping by STEP
from __future__ import absolute_import, print_function
+import os
import sys
+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
+
if sys.version_info[0] >= 3:
xrange = range
More information about the Mercurial-devel
mailing list