aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-05 13:24:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-06 06:34:45 +0100
commitc8a4107132ce51f84ae84bf1ceb1c3fd90f156d3 (patch)
tree1e00741de6b8343957b853bd041e1a0a75297513 /lib
parente5782b71647d1eb6de53bde7bc4f6019a5589f21 (diff)
downloadbitbake-c8a4107132ce51f84ae84bf1ceb1c3fd90f156d3.tar.gz
command: Ensure we catch/handle exceptions
If an exception occurs in early setup, bitbake could just hang. Return the exception rather than doing that. [YOCTO #14408] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/command.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py
index f530cf844..a81dcb136 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -65,9 +65,17 @@ class Command:
# Ensure cooker is ready for commands
if command != "updateConfig" and command != "setFeatures":
- self.cooker.init_configdata()
- if not self.remotedatastores:
- self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker)
+ try:
+ self.cooker.init_configdata()
+ if not self.remotedatastores:
+ self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker)
+ except (Exception, SystemExit) as exc:
+ import traceback
+ if isinstance(exc, bb.BBHandledException):
+ # We need to start returning real exceptions here. Until we do, we can't
+ # tell if an exception is an instance of bb.BBHandledException
+ return None, "bb.BBHandledException()\n" + traceback.format_exc()
+ return None, traceback.format_exc()
if hasattr(CommandsSync, command):
# Can run synchronous commands straight away