Skip to content

fix: propagate exit code from rtk err and rtk test#939

Closed
niklasmarderx wants to merge 1 commit intortk-ai:masterfrom
niklasmarderx:fix/err-exit-code-846
Closed

fix: propagate exit code from rtk err and rtk test#939
niklasmarderx wants to merge 1 commit intortk-ai:masterfrom
niklasmarderx:fix/err-exit-code-846

Conversation

@niklasmarderx
Copy link
Copy Markdown
Contributor

Summary

rtk err false returned exit 0 even though false returns 1. The error was
detected and printed, but the process always exited successfully.

Same issue in run_test.

Fix

Both run_err and run_test now call std::process::exit(exit_code) when
the child process fails, consistent with how other RTK subcommands propagate
exit codes.

Before / After

# Before
rtk err false; echo $?   # 0
# After
rtk err false; echo $?   # 1

Closes #846

Both run_err and run_test returned Ok(()) regardless of the underlying
command's exit status. This meant `rtk err false` exited 0 even though
`false` returns 1.

Now both call std::process::exit(exit_code) when the child process
fails, matching the behavior of other RTK subcommands.

Closes #846
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 31, 2026

CLA assistant check
All committers have signed the CLA.

@niklasmarderx niklasmarderx changed the base branch from master to develop March 31, 2026 07:54
@niklasmarderx niklasmarderx changed the base branch from develop to master March 31, 2026 07:55
@niklasmarderx
Copy link
Copy Markdown
Contributor Author

Closing this — the develop branch already addresses the exit code propagation through the Result<i32> refactor in #869, so this fix would conflict. The bug only affects master, which should be resolved once develop merges in.

Sorry for the noise with the base branch switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: rtk err swallows exit code (returns 0 instead of underlying exit code)

2 participants