# HG changeset patch # User Yuya Nishihara # Date 1409413094 -7200 # Node ID a0e0aa12b672c7bfa0003cd842eaf170e32c9aa8 # Parent 149fc8a44184fbeddd9d9602e3860455e92c1301 util.system: avoid buffering of subprocess output when it is piped util.system() copies subprocess' output through pipe if output file is not stdout. Because a file iterator has internal buffering, output won't be flushed until enough data is available. Therefore, it could easily miss important messages such as "waiting for lock". diff -r 149fc8a44184 -r a0e0aa12b672 mercurial/util.py --- a/mercurial/util.py Fri Oct 17 09:57:05 2014 +0900 +++ b/mercurial/util.py Sat Aug 30 17:38:14 2014 +0200 @@ -649,7 +649,10 @@ proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, env=env, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - for line in proc.stdout: + while True: + line = proc.stdout.readline() + if not line: + break out.write(line) proc.wait() rc = proc.returncode