Mercurial > public > mercurial-scm > hg-stable
diff mercurial/chgserver.py @ 31124:fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Since fd598149112b changed the signature of ui.system(), chgui.system()
should have been updated. This patch factors out the util.system() call
so that chg can override how a shell command is executed.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 19 Feb 2017 01:00:10 +0900 |
parents | cb899ee133d8 |
children | 3f8f53190d6a |
line wrap: on
line diff
--- a/mercurial/chgserver.py Tue Feb 21 18:22:07 2017 +0100 +++ b/mercurial/chgserver.py Sun Feb 19 01:00:10 2017 +0900 @@ -179,17 +179,16 @@ else: self._csystem = csystem - def system(self, cmd, environ=None, cwd=None, onerr=None, - errprefix=None): + def _runsystem(self, cmd, environ, cwd, onerr, errprefix, out): # fallback to the original system method if the output needs to be # captured (to self._buffers), or the output stream is not stdout # (e.g. stderr, cStringIO), because the chg client is not aware of # these situations and will behave differently (write to stdout). - if (any(s[1] for s in self._bufferstates) + if (out is not self.fout or not util.safehasattr(self.fout, 'fileno') or self.fout.fileno() != util.stdout.fileno()): - return super(chgui, self).system(cmd, environ, cwd, onerr, - errprefix) + return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr, + errprefix=errprefix, out=out) self.flush() rc = self._csystem(cmd, util.shellenviron(environ), cwd) if rc and onerr: