@@ -59,16 +59,20 @@
def badmethod(self):
pass
+class dummypipe(object):
+ def close(self):
+ pass
+
def main():
ui = uimod.ui()
checkobject(badpeer())
checkobject(httppeer.httppeer(ui, 'http://localhost'))
checkobject(localrepo.localpeer(dummyrepo()))
- checkobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, None, None,
- None, None))
- checkobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, None, None,
- None, None))
+ checkobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, dummypipe(),
+ dummypipe(), None, None))
+ checkobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, dummypipe(),
+ dummypipe(), None, None))
checkobject(bundlerepo.bundlepeer(dummyrepo()))
checkobject(statichttprepo.statichttppeer(dummyrepo()))
checkobject(unionrepo.unionpeer(dummyrepo()))
@@ -156,13 +156,13 @@
# move to threading.
stdin, stdout, stderr, proc = util.popen4(cmd, bufsize=0, env=sshenv)
- stdout = doublepipe(ui, util.bufferedinputpipe(stdout), stderr)
- stdin = doublepipe(ui, stdin, stderr)
-
return proc, stdin, stdout, stderr
def _performhandshake(ui, stdin, stdout, stderr):
def badresponse():
+ # Flush any output on stderr.
+ _forwardoutput(ui, stderr)
+
msg = _('no suitable response from remote hg')
hint = ui.config('ui', 'ssherrorhint')
raise error.RepoError(msg, hint=hint)
@@ -331,6 +331,9 @@
if not caps:
badresponse()
+ # Flush any output on stderr before proceeding.
+ _forwardoutput(ui, stderr)
+
return protoname, caps
class sshv1peer(wireproto.wirepeer):
@@ -347,6 +350,12 @@
# self._subprocess is unused. Keeping a handle on the process
# holds a reference and prevents it from being garbage collected.
self._subprocess = proc
+
+ # And we hook up our "doublepipe" wrapper to allow querying
+ # stderr any time we perform I/O.
+ stdout = doublepipe(ui, util.bufferedinputpipe(stdout), stderr)
+ stdin = doublepipe(ui, stdin, stderr)
+
self._pipeo = stdin
self._pipei = stdout
self._pipee = stderr