[PATCH v2 stable] sshpeer: try harder to snag stderr when stdout closes unexpectedly
Augie Fackler
raf at durin42.com
Fri Apr 21 20:32:32 UTC 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1492114180 14400
# Thu Apr 13 16:09:40 2017 -0400
# Branch stable
# Node ID 8862fd11cc7d27512a4b4c2a56c983d68609660b
# Parent 6e0368b6e0bb2aa5210daec091c0200583553a78
sshpeer: try harder to snag stderr when stdout closes unexpectedly
Resolves test failures on FreeBSD, but I'm not happy about the fix.
A previous version of this also wrapped readline by putting the hack
in the _call method on doublepipe. That was confusing for readers and
wasn't necessary - just doing this on read() is sufficient to fix the
bugs I'm observing. We can always come back and do readline later if
needed.
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -91,7 +91,15 @@ class doublepipe(object):
return self._call('write', data)
def read(self, size):
- return self._call('read', size)
+ r = self._call('read', size)
+ if size != 0 and not r:
+ # We've observed a condition that indicates the
+ # stdout closed unexpectedly. Check stderr one
+ # more time and snag anything that's there before
+ # letting anyone know the main part of the pipe
+ # closed prematurely.
+ _forwardoutput(self._ui, self._side)
+ return r
def readline(self):
return self._call('readline')
More information about the Mercurial-devel
mailing list