# HG changeset patch # User Augie Fackler # Date 1492114180 14400 # Node ID ad6c5497cd155be05ce69cd52b618a0f0109cdb1 # 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 -r 6e0368b6e0bb -r ad6c5497cd15 mercurial/sshpeer.py --- a/mercurial/sshpeer.py Thu Apr 20 22:51:28 2017 +0900 +++ b/mercurial/sshpeer.py Thu Apr 13 16:09:40 2017 -0400 @@ -91,7 +91,15 @@ 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')