comparison 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
comparison
equal deleted inserted replaced
13438:48463d889d4e 13439:d724a69309e0
384 print error message and return status, else raise onerr object as 384 print error message and return status, else raise onerr object as
385 exception. 385 exception.
386 386
387 if out is specified, it is assumed to be a file-like object that has a 387 if out is specified, it is assumed to be a file-like object that has a
388 write() method. stdout and stderr will be redirected to out.''' 388 write() method. stdout and stderr will be redirected to out.'''
389 try:
390 sys.stdout.flush()
391 except Exception:
392 pass
389 def py2shell(val): 393 def py2shell(val):
390 'convert python object into string that is useful to shell' 394 'convert python object into string that is useful to shell'
391 if val is None or val is False: 395 if val is None or val is False:
392 return '0' 396 return '0'
393 if val is True: 397 if val is True: