Mercurial > public > mercurial-scm > hg
comparison mercurial/sshrepo.py @ 3034:2b0bc36a48d8
sshrepo: flush stderr before connecting to the hg server
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 02 Sep 2006 21:08:54 +0200 |
parents | 345bac2bc4ec |
children | adf7f3421c55 |
comparison
equal
deleted
inserted
replaced
3033:892eb1b4f973 | 3034:2b0bc36a48d8 |
---|---|
50 | 50 |
51 def url(self): | 51 def url(self): |
52 return self._url | 52 return self._url |
53 | 53 |
54 def validate_repo(self, ui, sshcmd, args, remotecmd): | 54 def validate_repo(self, ui, sshcmd, args, remotecmd): |
55 # cleanup up previous run | |
56 self.cleanup() | |
57 | |
55 cmd = '%s %s "%s -R %s serve --stdio"' | 58 cmd = '%s %s "%s -R %s serve --stdio"' |
56 cmd = cmd % (sshcmd, args, remotecmd, self.path) | 59 cmd = cmd % (sshcmd, args, remotecmd, self.path) |
57 | 60 |
58 ui.note('running %s\n' % cmd) | 61 ui.note('running %s\n' % cmd) |
59 self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b') | 62 self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b') |
88 if size == 0: break | 91 if size == 0: break |
89 l = self.pipee.readline() | 92 l = self.pipee.readline() |
90 if not l: break | 93 if not l: break |
91 self.ui.status(_("remote: "), l) | 94 self.ui.status(_("remote: "), l) |
92 | 95 |
93 def __del__(self): | 96 def cleanup(self): |
94 try: | 97 try: |
95 self.pipeo.close() | 98 self.pipeo.close() |
96 self.pipei.close() | 99 self.pipei.close() |
97 # read the error descriptor until EOF | 100 # read the error descriptor until EOF |
98 for l in self.pipee: | 101 for l in self.pipee: |
99 self.ui.status(_("remote: "), l) | 102 self.ui.status(_("remote: "), l) |
100 self.pipee.close() | 103 self.pipee.close() |
101 except: | 104 except: |
102 pass | 105 pass |
106 | |
107 __del__ = cleanup | |
103 | 108 |
104 def do_cmd(self, cmd, **args): | 109 def do_cmd(self, cmd, **args): |
105 self.ui.debug(_("sending %s command\n") % cmd) | 110 self.ui.debug(_("sending %s command\n") % cmd) |
106 self.pipeo.write("%s\n" % cmd) | 111 self.pipeo.write("%s\n" % cmd) |
107 for k, v in args.items(): | 112 for k, v in args.items(): |