I want to add a error handler for do_image_* tasks of core-image-minimal(e.g., when do_image_* failed, execute my handler).
我想为核心映像最小的do_image_*任务添加一个错误处理程序(例如,当do_image_*失败时,执行我的处理程序)。
I tried bb.build.TaskFailed
, but it seems to be for all tasks. What should I do?
我尝试了bb.build.TaskFailed,但它似乎适用于所有任务。我该怎么办?
更多回答
优秀答案推荐
I found a solution that works. If there are other more suitable solutions, please let me know, thank you. Everyone is welcome to discuss.
我找到了一个有效的解决方案。如果还有其他更合适的解决方案,请告诉我,谢谢。欢迎大家讨论。
I use the bb.build.TaskFailed
event, although it's global, not specific to a recipe. In the handler body, I use e.getTask() to determine whether the specified task failed, and if so, execute my code.
我使用bb.build.TaskFailed事件,尽管它是全局的,而不是特定于配方。在处理程序主体中,我使用e.getTask()来确定指定的任务是否失败,如果失败,则执行我的代码。
addhandler cjlhandler
python cjlhandler() {
bb.warn("TaskName is %s" % e.getTask())
# you should add if statement to determine whether the specified task failed
}
cjlhandler[eventmask] = "bb.build.TaskFailed"
更多回答
我是一名优秀的程序员,十分优秀!