Mercurial > public > mercurial-scm > hg-stable
diff mercurial/sshpeer.py @ 36637:1151c731686e
sshpeer: don't read from stderr when that behavior is disabled
We previously prevented the creation of doublepipe instances when
we're not supposed to automatically read from stderr. However,
there were other automatic calls to read from stderr that were
undermining this effort.
This commit prevents all automatic reads from stderr from occurring
when they are supposed to be disabled.
Because stderr is no longer being read, we need to call "readavailable"
from tests so stderr is read from.
Test output changes because stderr is now always (manually) read after
stdout. And, since sshpeer no longer automatically tends to stderr,
no "remote: " messages are printed. This should fix non-deterministic
test output.
FWIW, doublepipe automatically reads from stderr when reading from
stdout, so I'm not sure some of these calls to self._readerr() are
even needed.
Differential Revision: https://phab.mercurial-scm.org/D2571
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 02 Mar 2018 18:50:49 -0500 |
parents | 3cd245945ef3 |
children | 70415568ea65 |
line wrap: on
line diff
--- a/mercurial/sshpeer.py Thu Feb 15 17:18:26 2018 +0100 +++ b/mercurial/sshpeer.py Fri Mar 02 18:50:49 2018 -0500 @@ -365,6 +365,7 @@ self._pipei = stdout self._pipee = stderr self._caps = caps + self._autoreadstderr = autoreadstderr # Commands that have a "framed" response where the first line of the # response contains the length of that response. @@ -510,10 +511,12 @@ def _getamount(self): l = self._pipei.readline() if l == '\n': - self._readerr() + if self._autoreadstderr: + self._readerr() msg = _('check previous remote output') self._abort(error.OutOfBandError(hint=msg)) - self._readerr() + if self._autoreadstderr: + self._readerr() try: return int(l) except ValueError: @@ -528,7 +531,8 @@ self._pipeo.write(data) if flush: self._pipeo.flush() - self._readerr() + if self._autoreadstderr: + self._readerr() class sshv2peer(sshv1peer): """A peer that speakers version 2 of the transport protocol."""