mirror of
https://git.yoctoproject.org/poky
synced 2026-03-19 13:49:41 +01:00
bitbake: server/process: Improve idle loop exit code
When idle handlers want to exit, returning "False" isn't very clear and also causes challenges with the ordering of the removing the idle handler and marking that no async command is running. Use a specific class to signal the exit condition allowing clearer code and allowing the async command to be cleared after the handler has been removed, reducing any opportunity for races. (Bitbake rev: 102e8d0d4c5c0dd8c7ba09ad26589deec77e4308) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -128,22 +128,19 @@ class Command:
|
||||
else:
|
||||
return False
|
||||
except KeyboardInterrupt as exc:
|
||||
self.finishAsyncCommand("Interrupted")
|
||||
return False
|
||||
return bb.server.process.idleFinish("Interrupted")
|
||||
except SystemExit as exc:
|
||||
arg = exc.args[0]
|
||||
if isinstance(arg, str):
|
||||
self.finishAsyncCommand(arg)
|
||||
return bb.server.process.idleFinish(arg)
|
||||
else:
|
||||
self.finishAsyncCommand("Exited with %s" % arg)
|
||||
return False
|
||||
return bb.server.process.idleFinish("Exited with %s" % arg)
|
||||
except Exception as exc:
|
||||
import traceback
|
||||
if isinstance(exc, bb.BBHandledException):
|
||||
self.finishAsyncCommand("")
|
||||
return bb.server.process.idleFinish("")
|
||||
else:
|
||||
self.finishAsyncCommand(traceback.format_exc())
|
||||
return False
|
||||
return bb.server.process.idleFinish(traceback.format_exc())
|
||||
|
||||
def finishAsyncCommand(self, msg=None, code=None):
|
||||
if msg or msg == "":
|
||||
|
||||
Reference in New Issue
Block a user