[oe-commits] [openembedded-core] 04/15: terminal.py: avoid 100% cpu while waiting for phonehome pid file

git at git.openembedded.org git at git.openembedded.org
Sun Aug 27 08:37:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 15b4fcc29855aa10b45e4d69d47b052eb22f6d22
Author: Andre McCurdy <armccurdy at gmail.com>
AuthorDate: Fri Aug 25 13:36:30 2017 -0700

    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 at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/terminal.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 3c6220d..714772f 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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list