Преглед на файлове

tinfoil: When sending commands we need to process events

The server may be displaying useful information for the user through log
messages so we should display anything that has been sent. Its either this
or expecting every UI to implement this code around every command call
which isn't good API.

[YOCTO #14054]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Richard Purdie преди 3 години
родител
ревизия
64ae9d7e2f
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      lib/bb/tinfoil.py

+ 10 - 1
lib/bb/tinfoil.py

@@ -461,7 +461,16 @@ class Tinfoil:
         commandline = [command]
         if params:
             commandline.extend(params)
-        result = self.server_connection.connection.runCommand(commandline)
+        try:
+            result = self.server_connection.connection.runCommand(commandline)
+        finally:
+            while True:
+                event = self.wait_event()
+                if not event:
+                    break
+                if isinstance(event, logging.LogRecord):
+                    if event.taskpid == 0 or event.levelno > logging.INFO:
+                        self.logger.handle(event)
         if result[1]:
             raise TinfoilCommandFailed(result[1])
         return result[0]