ソースを参照

command: Ensure exceptions inheriting from BBHandledException are visible

Previous changes allowed BBHandledException to be detected but not exceptions
which inherit from it. Fix this. The code really needs totally reworking
to preserve the exceptions.

[YOCTO #14054]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Richard Purdie 3 年 前
コミット
ef762d92df
1 ファイル変更5 行追加1 行削除
  1. 5 1
      lib/bb/command.py

+ 5 - 1
lib/bb/command.py

@@ -81,8 +81,12 @@ class Command:
                 result = command_method(self, commandline)
                 result = command_method(self, commandline)
             except CommandError as exc:
             except CommandError as exc:
                 return None, exc.args[0]
                 return None, exc.args[0]
-            except (Exception, SystemExit):
+            except (Exception, SystemExit) as exc:
                 import traceback
                 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()
                 return None, traceback.format_exc()
             else:
             else:
                 return result, None
                 return result, None