threads / patch / 33871

patchremote-hg: set stdout to binary mode on win32

Subject: [PATCH] remote-hg: set stdout to binary mode on win32

## tl;dr

3 messages between May 19, 2013 and May 20, 2013. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Felipe Contreras· May 19, 2013, 11:53 UTC · lore
From: Amit Bakshi <ambakshi@gmail.com>

git clone hangs on windows, and file.write would return errno 22 inside of mercurial's windows.winstdout wrapper class. This patch sets stdout's mode to binary, fixing both issues.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 4 ++++
 1 file changed, 4 insertions(+)
Show changes to contrib/remote-helpers/git-remote-hg +4 −0
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index beb864b..01555dc 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -954,6 +954,10 @@ def main(args):
     marks_path = os.path.join(dirname, 'marks-hg')
     marks = Marks(marks_path)
 
+    if sys.platform == 'win32':
+        import msvcrt
+        msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
     parser = Parser(repo)
     for line in parser:
         if parser.check('capabilities'):
-- 
1.8.3.rc3.286.g3d43083
Felipe Contreras· May 19, 2013, 12:00 UTC · re: Felipe Contreras · lore

Re: [PATCH] remote-hg: set stdout to binary mode on win32

On Sun, May 19, 2013 at 6:53 AM, Felipe Contreras <felipe.contreras@gmail.com> wrote:

Show 5 quoted lines
> From: Amit Bakshi <ambakshi@gmail.com>
>
> git clone hangs on windows, and file.write would return errno 22 inside
> of mercurial's windows.winstdout wrapper class. This patch sets stdout's
> mode to binary, fixing both issues.

Forgot: [fc: cleaned up]

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
-- 
Felipe Contreras
Junio C Hamano· May 20, 2013, 18:18 UTC · re: Felipe Contreras · lore

Re: [PATCH] remote-hg: set stdout to binary mode on win32

Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 12 quoted lines
> On Sun, May 19, 2013 at 6:53 AM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> From: Amit Bakshi <ambakshi@gmail.com>
>>
>> git clone hangs on windows, and file.write would return errno 22 inside
>> of mercurial's windows.winstdout wrapper class. This patch sets stdout's
>> mode to binary, fixing both issues.
>
> Forgot:
> [fc: cleaned up]
>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Thanks, sounds like this is meant for 'master'?

← back to recent threads