Compare commits

...
Author SHA1 Message Date
Florian BRUNIAUXandClaude Sonnet 4.6 5c4809e07e docs: update ARCHITECTURE.md module count to 64
Sync module count with actual main.rs (64 modules) to pass pre-push validation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-03-13 10:33:10 +01:00
Florian BRUNIAUXandClaude Sonnet 4.6 25ad4d20a2 fix: forward exit codes in err, test, and summary commands
Commands `rtk err`, `rtk test`, and `rtk summary` were always returning
exit code 0, even when the wrapped command failed. The exit code was
computed but never forwarded via `std::process::exit`.

Fixes #557

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-03-13 10:32:12 +01:00
3 changed files with 45 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -293,7 +293,7 @@ SHARED utils.rs Helpers N/A ✓
tee.rs Full output recovery N/A ✓
```
**Total: 60 modules** (38 command modules + 22 infrastructure modules)
**Total: 64 modules** (42 command modules + 22 infrastructure modules)
### Module Count Breakdown
+37
View File
@@ -59,6 +59,9 @@ pub fn run_err(command: &str, verbose: u8) -> Result<()> {
println!("{}", rtk);
}
timer.track(command, "rtk run-err", &raw, &rtk);
if exit_code != 0 {
std::process::exit(exit_code);
}
Ok(())
}
@@ -100,6 +103,9 @@ pub fn run_test(command: &str, verbose: u8) -> Result<()> {
println!("{}", summary);
}
timer.track(command, "rtk run-test", &raw, &summary);
if exit_code != 0 {
std::process::exit(exit_code);
}
Ok(())
}
@@ -268,4 +274,35 @@ mod tests {
assert!(filtered.contains("error"));
assert!(!filtered.contains("info"));
}
#[test]
#[ignore]
fn test_err_forwards_exit_code_nonzero() {
// Requires rtk to be installed on PATH (cargo install --path .)
let output = std::process::Command::new("rtk")
.args(["err", "sh", "-c", "exit 2"])
.output()
.expect("failed to run rtk — install with: cargo install --path .");
assert_eq!(output.status.code(), Some(2));
}
#[test]
#[ignore]
fn test_err_forwards_exit_code_zero() {
let output = std::process::Command::new("rtk")
.args(["err", "sh", "-c", "exit 0"])
.output()
.expect("failed to run rtk — install with: cargo install --path .");
assert_eq!(output.status.code(), Some(0));
}
#[test]
#[ignore]
fn test_test_forwards_exit_code_nonzero() {
let output = std::process::Command::new("rtk")
.args(["test", "sh", "-c", "exit 1"])
.output()
.expect("failed to run rtk — install with: cargo install --path .");
assert_eq!(output.status.code(), Some(1));
}
}
+7
View File
@@ -31,9 +31,16 @@ pub fn run(command: &str, verbose: u8) -> Result<()> {
let stderr = String::from_utf8_lossy(&output.stderr);
let raw = format!("{}\n{}", stdout, stderr);
let exit_code = output
.status
.code()
.unwrap_or(if output.status.success() { 0 } else { 1 });
let summary = summarize_output(&raw, command, output.status.success());
println!("{}", summary);
timer.track(command, "rtk summary", &raw, &summary);
if exit_code != 0 {
std::process::exit(exit_code);
}
Ok(())
}