mirror of
https://git.yoctoproject.org/poky
synced 2026-10-15 04:57:15 +00: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:
1 parent
ff2d778f6d
commit
c4ecfc4dc5
3 files changed
+20
-17
No files matched your search
@@ -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