Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/chgserver.py @ 38801:23a00bc90a3c stable
chgserver: do not send system() back to client if stdio redirected (issue5992)
As the chg client doesn't know server-side stdio redirection, the server
shouldn't upcall on "runsystem" request if the stdio streams are redirected.
This patch teaches ui to remember the redirection flag, which is updated by
the caller right now. Future patches (for default) will add ui methods to
manage this flag internally.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 26 Sep 2018 21:24:14 +0900 |
parents | 1b9be0b26511 |
children | a9f56e4501c1 |
comparison
equal
deleted
inserted
replaced
38800:1b9be0b26511 | 38801:23a00bc90a3c |
---|---|
198 self._csystem = csystem | 198 self._csystem = csystem |
199 | 199 |
200 def _runsystem(self, cmd, environ, cwd, out): | 200 def _runsystem(self, cmd, environ, cwd, out): |
201 # fallback to the original system method if | 201 # fallback to the original system method if |
202 # a. the output stream is not stdout (e.g. stderr, cStringIO), | 202 # a. the output stream is not stdout (e.g. stderr, cStringIO), |
203 # b. or stdout is redirected by protectstdio(), | |
203 # because the chg client is not aware of these situations and | 204 # because the chg client is not aware of these situations and |
204 # will behave differently (i.e. write to stdout). | 205 # will behave differently (i.e. write to stdout). |
205 if (out is not self.fout | 206 if (out is not self.fout |
206 or not util.safehasattr(self.fout, 'fileno') | 207 or not util.safehasattr(self.fout, 'fileno') |
207 or self.fout.fileno() != procutil.stdout.fileno()): | 208 or self.fout.fileno() != procutil.stdout.fileno() |
209 or self._finoutredirected): | |
208 return procutil.system(cmd, environ=environ, cwd=cwd, out=out) | 210 return procutil.system(cmd, environ=environ, cwd=cwd, out=out) |
209 self.flush() | 211 self.flush() |
210 return self._csystem(cmd, procutil.shellenviron(environ), cwd) | 212 return self._csystem(cmd, procutil.shellenviron(environ), cwd) |
211 | 213 |
212 def _runpager(self, cmd, env=None): | 214 def _runpager(self, cmd, env=None): |