comparison mercurial/sshpeer.py @ 32062:ad6c5497cd15 stable

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.
author Augie Fackler <augie@google.com>
date Thu, 13 Apr 2017 16:09:40 -0400
parents cc2382b60007
children 05906b8e1d23 f93975a5ebe8
comparison
equal deleted inserted replaced
32061:6e0368b6e0bb 32062:ad6c5497cd15
89 89
90 def write(self, data): 90 def write(self, data):
91 return self._call('write', data) 91 return self._call('write', data)
92 92
93 def read(self, size): 93 def read(self, size):
94 return self._call('read', size) 94 r = self._call('read', size)
95 if size != 0 and not r:
96 # We've observed a condition that indicates the
97 # stdout closed unexpectedly. Check stderr one
98 # more time and snag anything that's there before
99 # letting anyone know the main part of the pipe
100 # closed prematurely.
101 _forwardoutput(self._ui, self._side)
102 return r
95 103
96 def readline(self): 104 def readline(self):
97 return self._call('readline') 105 return self._call('readline')
98 106
99 def _call(self, methname, data=None): 107 def _call(self, methname, data=None):