bitbake: command: Ensure that failure cases call finishAsyncComand

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.

(Bitbake rev: 367a83ed46c7fbcdd06579b6cc3a6e48a89ca7fb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2023-01-02 16:21:22 +00:00
parent 59a06db5dc
commit 82e77db0ce

View File

@@ -117,7 +117,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)
@@ -129,7 +129,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: