Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 13439:d724a69309e0 stable
util: flush stdout before calling external processes
stdout could have content in its buffer while a subprocess ran and emitted
output.
Flushing stdout ensures that output now comes in the right order.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 18 Feb 2011 03:35:01 +0100 |
parents | 14f3795a5ed7 |
children | 16118b4859a1 |
line wrap: on
line diff
--- a/mercurial/util.py Fri Feb 18 03:34:47 2011 +0100 +++ b/mercurial/util.py Fri Feb 18 03:35:01 2011 +0100 @@ -386,6 +386,10 @@ if out is specified, it is assumed to be a file-like object that has a write() method. stdout and stderr will be redirected to out.''' + try: + sys.stdout.flush() + except Exception: + pass def py2shell(val): 'convert python object into string that is useful to shell' if val is None or val is False: