[PATCH 2 of 5] ui: allow capture of subprocess output
Yuya Nishihara
yuya at tcha.org
Fri Apr 24 08:49:49 CDT 2015
On Fri, 24 Apr 2015 00:56:22 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1429797459 -3600
> # Thu Apr 23 14:57:39 2015 +0100
> # Branch stable
> # Node ID 8aea112e68b1f90f8b2917f06fd4081116502c64
> # Parent 61a2951a30f7c18501027501f7642dd632e72fcd
> ui: allow capture of subprocess output
>
> We want to capture hooks output during bundle2 processing. For this purpose we
> introduce a new 'subproc' argument to 'ui.pushbuffer'. When set, the output of
> sub process created through 'ui.system' will be captured in the buffer too.
>
> This will be used in the next changeset.
> def write_err(self, *args, **opts):
> try:
> - if self._bufferstates and self._bufferstates[-1]:
> + if self._bufferstates and self._bufferstates[-1][0]:
> return self.write(*args, **opts)
> if not getattr(self.fout, 'closed', False):
> self.fout.flush()
> for a in args:
> self.ferr.write(str(a))
> @@ -832,12 +836,15 @@ class ui(object):
>
> def system(self, cmd, environ={}, cwd=None, onerr=None, errprefix=None):
> '''execute shell command with appropriate output stream. command
> output will be redirected if fout is not stdout.
> '''
> + out = self.fout
> + if util.any(s[1] for s in self._bufferstates):
> + out = self
Nitpick, why does it check any bufferstates unlike write_error() ?
More information about the Mercurial-devel
mailing list