Mercurial > public > mercurial-scm > hg
comparison hgext/chgserver.py @ 30473:39d13b8c101d
py3: bulk replace sys.stdin/out/err by util's
Almost all sys.stdin/out/err in hgext/ and mercurial/ are replaced by util's.
There are a few exceptions:
- lsprof.py and statprof.py are untouched since they are a kind of vendor
code and they never import mercurial modules right now.
- ui._readline() needs to replace sys.stdin and stdout to pass them to
raw_input(). We'll need another workaround here.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 20 Oct 2016 23:53:36 +0900 |
parents | 318a24b52eeb |
children | dd539e2d89aa |
comparison
equal
deleted
inserted
replaced
30472:277f4fe6d01a | 30473:39d13b8c101d |
---|---|
230 # captured (to self._buffers), or the output stream is not stdout | 230 # captured (to self._buffers), or the output stream is not stdout |
231 # (e.g. stderr, cStringIO), because the chg client is not aware of | 231 # (e.g. stderr, cStringIO), because the chg client is not aware of |
232 # these situations and will behave differently (write to stdout). | 232 # these situations and will behave differently (write to stdout). |
233 if (any(s[1] for s in self._bufferstates) | 233 if (any(s[1] for s in self._bufferstates) |
234 or not util.safehasattr(self.fout, 'fileno') | 234 or not util.safehasattr(self.fout, 'fileno') |
235 or self.fout.fileno() != sys.stdout.fileno()): | 235 or self.fout.fileno() != util.stdout.fileno()): |
236 return super(chgui, self).system(cmd, environ, cwd, onerr, | 236 return super(chgui, self).system(cmd, environ, cwd, onerr, |
237 errprefix) | 237 errprefix) |
238 # copied from mercurial/util.py:system() | 238 # copied from mercurial/util.py:system() |
239 self.flush() | 239 self.flush() |
240 def py2shell(val): | 240 def py2shell(val): |