summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2017-08-25 13:36:30 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 22:29:45 +0100
commit6b0cf568e9fbe28fb6e7b17f4ad92348d33e2bf4 (patch)
treeabb554748ce5a4afddeb2fa241ed68215af05893
parent77797a95569252024fca094d33ae9ecbc833597f (diff)
downloadopenembedded-core-contrib-6b0cf568e9fbe28fb6e7b17f4ad92348d33e2bf4.tar.gz
openembedded-core-contrib-6b0cf568e9fbe28fb6e7b17f4ad92348d33e2bf4.tar.bz2
openembedded-core-contrib-6b0cf568e9fbe28fb6e7b17f4ad92348d33e2bf4.zip
terminal.py: avoid 100% cpu while waiting for phonehome pid file
Some of the less common terminal types haven't been tested with the recent phonehome pid file changes and there may be error cases where the pid file is never created. Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/terminal.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 3c6220dfce..714772f741 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -221,6 +221,7 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
# to a file using a "phonehome" wrapper script, then monitor the pid
# until it exits.
import tempfile
+ import time
pidfile = tempfile.NamedTemporaryFile(delete = False).name
try:
sh_cmd = "oe-gnome-terminal-phonehome " + pidfile + " " + sh_cmd
@@ -232,13 +233,13 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
raise ExecutionError(sh_cmd, pipe.returncode, output)
while os.stat(pidfile).st_size <= 0:
+ time.sleep(0.01)
continue
with open(pidfile, "r") as f:
pid = int(f.readline())
finally:
os.unlink(pidfile)
- import time
while True:
try:
os.kill(pid, 0)