diff mbox series

command: Ensure that failure cases call finishAsyncComand

Message ID 20230102162146.1066346-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 367a83ed46c7fbcdd06579b6cc3a6e48a89ca7fb
Headers show
Series command: Ensure that failure cases call finishAsyncComand | expand

Commit Message

Richard Purdie Jan. 2, 2023, 4:21 p.m. UTC
There are a couple of failure cases that runCommands needs to better
handle, ensuring finishAsyncCommand is called. This doesn't matter if the
server is about to shut down but for memory resident bitbake and with
threading enabled, correctness is more important this could could in
theory lead to problems with the recent code changes.

By using the idleFinish class, it ensures the current async command
is terminated correctly and the various state pieces around commands
finishing are called. This also makes the code more uniform matching
the other exception handling code.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/command.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 2b25ce5385..5d321cf9fa 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -118,7 +118,7 @@  class Command:
                 # updateCache will trigger a shutdown of the parser
                 # and then raise BBHandledException triggering an exit
                 self.cooker.updateCache()
-                return False
+                return bb.server.process.idleFinish("Cooker in error state")
             if self.currentAsyncCommand is not None:
                 (command, options) = self.currentAsyncCommand
                 commandmethod = getattr(CommandsAsync, command)
@@ -130,7 +130,7 @@  class Command:
                     commandmethod(self.cmds_async, self, options)
                     return False
             else:
-                return False
+                return bb.server.process.idleFinish("Nothing to do, no async command?")
         except KeyboardInterrupt as exc:
             return bb.server.process.idleFinish("Interrupted")
         except SystemExit as exc: