You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, @marc-hb , sorry my description is not quite clear. The issue happens on a west extension command and my installed west version is v1.2.0
Hook following extension command to a west project can reproduce the issue.
# example.pyfromwest.commandsimportWestCommandclassExample(WestCommand):
def__init__(self):
super().__init__(
'example',
# Keep this in sync with the string in west-commands.yml.'example',
"example")
# This may raise an exceptionself.err("show a log")
defdo_add_parser(self, parser_adder):
parser=self._parser(parser_adder, epilog='')
returnparserdefdo_run(self, args):
pass
Initialization is often tricky: ordering dependencies can be hard. So it's not a major surprise that some things don't work (yet) in an __init__() method. I just had a look at initializations in zephyr/scripts/west_commands/ and none of them has any logic, just constants. This should probably be better documented but: "In Rome, do as the Romans do?" I recommend you defer any logic somewhere after __init__() time.
This being said, error-handling should be better: better message and nothing should ever trigger an infinite loop/recursion.
If use any log api like
self.err
orself.die
in WestCommand's__init__
function, it may throw following exception:In
__init__
phase, the variableconfig
is None, but the propertycolor_ui
try infinitely get it fromconfig
The text was updated successfully, but these errors were encountered: