Repository navigation
refactor: preserve exit code in ocppi CommandFailedError - #2181
Conversation
|
Hi @wrj97-alt. Thanks for your PR. I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
1. Add ret_ member and exitStatus() accessor to CommandFailedError 2. Convert raw wait() status to real exit code via WEXITSTATUS/WTERMSIG+128 3. Cli::enter catches CommandFailedError and returns the preserved exit code 4. Cli::reuseContainer uses exitStatus() instead of collapsing to EXIT_FAILURE 5. Add ExecPreservesCommandExitStatus test verifying exit code 42 is preserved Influence: 1. Test ll-cli enter with a command that exits non-zero, verify exit code matches 2. Test ll-cli enter with a command killed by signal, verify signal+128 exit code 3. Test container reuse scenario preserves the real command exit code 4. Run CommonCLITest.* to verify all existing and new test cases pass refactor: 保留 ocppi CommandFailedError 中的退出码 1. 为 CommandFailedError 新增 ret_ 成员和 exitStatus() 访问器 2. 通过 WEXITSTATUS/WTERMSIG+128 将 wait() 原始状态转换为真实退出码 3. Cli::enter 捕获 CommandFailedError 并返回保留的退出码 4. Cli::reuseContainer 使用 exitStatus() 替代直接折叠为 EXIT_FAILURE 5. 新增 ExecPreservesCommandExitStatus 测试,验证退出码 42 被正确保留 Influence: 1. 测试 ll-cli enter 执行非零退出码命令,验证退出码一致 2. 测试 ll-cli enter 执行被信号杀死的命令,验证返回信号码+128 3. 测试容器复用场景下真实命令退出码的保留 4. 运行 CommonCLITest.* 验证已有及新增测试用例全部通过
2e51833 to
46822ea
Compare
Summary
Refactor ocppi
CommandFailedErrorto preserve the process exit code, soll-cli entercan return the real exit code of the command executed inside the container.Related Multica issue: LL-39
Changes
CommandFailedError.hpp: Addedret_member andexitStatus()accessor;what()message now shows the converted exit code instead of rawwait()status.cli.cpp(Cli::enter): CatchesCommandFailedErrorand returnse.exitStatus()as the process exit code; other exceptions still return-1.cli.cpp(Cli::reuseContainer): UsesexitStatus()via_exit(e.exitStatus())instead of collapsing toEXIT_FAILURE, resolving the existing TODO.common_cli_test.cpp: AddedExecPreservesCommandExitStatustest verifying exit code 42 is correctly preserved.