mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
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".
This commit is contained in:
parent
a290d1f800
commit
e7ee70da05
@ -649,7 +649,10 @@ def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None, out=None):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user