ssh: skip noise generated by remote shell
authorMatt Mackall <mpm@selenic.com>
Fri, 31 Mar 2006 03:25:35 -0600
changeset 2028 1f1fc418a96c
parent 2027 94d3170399e1
child 2029 d436b21b20dc
ssh: skip noise generated by remote shell we send a dummy command with known output to get in sync
mercurial/sshrepo.py
--- a/mercurial/sshrepo.py	Thu Mar 30 19:28:41 2006 -0800
+++ b/mercurial/sshrepo.py	Fri Mar 31 03:25:35 2006 -0600
@@ -36,6 +36,16 @@
         ui.note('running %s\n' % cmd)
         self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
 
+        # skip any noise generated by remote shell
+        r = self.do_cmd("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
+        l1 = ""
+        while 1:
+            l2 = r.readline()
+            self.readerr()
+            if l1 == "1\n" and l2 == "\n":
+                break
+            l1 = l2
+
     def readerr(self):
         while 1:
             size = os.fstat(self.pipee.fileno())[stat.ST_SIZE]