Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c4809e07e | ||
|
|
25ad4d20a2 |
No files matched your search
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user