mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
Try to make running background commands more responsive
Calling communicate() blocks the process; but since we're writing the output directly to a file and not sending any input we don't actually need to call communicate(), just poll() (so that we can check the returncode attribute). Subjectively this does appear to improve performance although it has not fixed the ConnectionResetError issues. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
378413299c
commit
ca56e1c664
|
@ -309,7 +309,10 @@ def runcmd(cmd, destdir=None, printerr=True, outfile=None, logger=None, shell=Fa
|
|||
proc = subprocess.Popen(cmd, stdout=out, stderr=out, cwd=destdir, shell=shell)
|
||||
global child_pid
|
||||
child_pid = proc.pid
|
||||
proc.communicate()
|
||||
proc.poll()
|
||||
while proc.returncode is None:
|
||||
proc.poll()
|
||||
time.sleep(0.05)
|
||||
if proc.returncode:
|
||||
out.seek(0)
|
||||
output = out.read()
|
||||
|
|
Loading…
Reference in New Issue
Block a user