mercurial/sshpeer.py
branchstable
changeset 32062 ad6c5497cd15
parent 31953 cc2382b60007
child 33100 05906b8e1d23
child 33636 f93975a5ebe8
--- 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')