diff mercurial/wireproto.py @ 36994:d683c7367989

wireproto: explicitly flush stdio to prevent stalls on Windows This is the key to fixing the hangs on Windows in D2720[1]. I put flushes in a bunch of other places that didn't help, but I suspect that's more a lack of test coverage than anything else. Chasing down stuff like this is pretty painful. I'm wondering if we can put a proxy around sys.stderr (and sys.stdout?) on Windows (only when daemonized?) that will flush on every write (or at least every write with a '\n'). [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-March/113352.html
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Mar 2018 23:58:01 -0500
parents 4901d1e22b27
children cd0ca979a8b8
line wrap: on
line diff
--- a/mercurial/wireproto.py	Sun Mar 18 15:32:49 2018 -0400
+++ b/mercurial/wireproto.py	Sat Mar 10 23:58:01 2018 -0500
@@ -1077,6 +1077,7 @@
                     util.stderr.write("abort: %s\n" % exc)
                     if exc.hint is not None:
                         util.stderr.write("(%s)\n" % exc.hint)
+                    util.stderr.flush()
                     return pushres(0, output.getvalue() if output else '')
                 except error.PushRaced:
                     return pusherr(pycompat.bytestr(exc),