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
{{ message }}
Repository navigation
An empty --shell= value and a bare rtk test answer with an anyhow chain at exit 1, not the promised clap usage error #4290
src/core/shell.rs states the contract in SHELL_ARITY_MESSAGE's own doc: "One rule, one wording: the CLI reports it as a clap usage error before execution." Two ways of misusing these commands still answer with an anyhow chain at exit 1 instead, which is the shape #4125 spent two rounds removing from its other paths.
Found while reviewing #4125, on its head. Neither is a regression that PR introduced — the second is arguably an improvement that went half way — so neither held it.
1. An empty --shell= value
$ rtk err --shell= /bin/true
rtk: Failed to run err command: Failed to prepare err command: shell must not be empty exit 1
$ rtk test --shell= /bin/true same, exit 1
$ rtk summary --shell= /bin/true same, exit 1
$ rtk run --shell= -c 'echo hi' error: the argument '--shell <SHELL>' cannot be used with '[ARGS]...' exit 2
run is right only because clap catches a conflict first. Every other --shell misspelling on the three positional surfaces now exits 2 — a missing value, a split script — so this is the last one out of line. The merge-base exited 2 here too.
shell_command's bail!("shell must not be empty") is doing the work clap should: a value_parser rejecting an empty value would move it before execution and make all four consistent.
2. A bare rtk test
$ rtk test
rtk: Failed to run test command: Failed to prepare test command: command is required exit 1
$ /usr/bin/test ; echo $? 1
$ dash -c 'test' ; echo $? 1
Here the exit code is now correct and the merge-base's was not — it exited 0. rtk test deliberately shadows the POSIX utility, which exits 1 with no arguments, so 1 is the right answer and only the message is wrong: the real test prints nothing. rtk err and rtk summary were fixed by giving their positionals required = true, which test cannot take without losing the POSIX behaviour, so this one wants the bail replaced by a silent 1 rather than a clap error.
Scope note
Both are small and both fail rather than succeeding, which is why they are here and not in that PR. They are grouped because they are one question — which layer answers a misuse — and because fixing them separately would touch the same two functions twice.
--shell= (empty) and bare rtk test still emit anyhow chains at exit 1 instead of clap usage errors / silent exit 1, per the contract in src/core/shell.rs's SHELL_ARITY_MESSAGE.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/core/shell.rs
Suggested Actions
Replace shell_command's bail!("shell must not be empty") with a clap value_parser rejecting empty --shell values
For bare rtk test, drop the bail! message and just exit 1 silently to match POSIX test's no-arg behavior
Activity
rtk-wshm-sync-bot commentedon Sep 26, 2026
🔍 Automated Triage
buglowSummary
--shell=(empty) and barertk teststill emit anyhow chains at exit 1 instead of clap usage errors / silent exit 1, per the contract insrc/core/shell.rs's SHELL_ARITY_MESSAGE.📁 Relevant files
src/core/shell.rsSuggested Actions
rtk test, drop the bail! message and just exit 1 silently to match POSIXtest's no-arg behaviorrtk run --shell=stays exit 2 via clap's existing conflict detection after the value_parser changeTriaged automatically by wshm · This is an automated analysis, not a human review.
JaiPatel713 commentedon Sep 26, 2026
Hi, I'd like to work on this. I'll cover both cases described here and add tests for the expected exit status/output behavior.