Fix bug 5: truncate coverage error output to last 5 lines
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -452,7 +452,25 @@ impl WorkflowApi {
|
|||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
return Err(bad_request(format!("Coverage command failed: {stderr}")));
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
|
let combined: Vec<&str> = stdout
|
||||||
|
.lines()
|
||||||
|
.chain(stderr.lines())
|
||||||
|
.filter(|l| !l.trim().is_empty())
|
||||||
|
.collect();
|
||||||
|
let tail: Vec<&str> = combined
|
||||||
|
.iter()
|
||||||
|
.rev()
|
||||||
|
.take(5)
|
||||||
|
.rev()
|
||||||
|
.copied()
|
||||||
|
.collect();
|
||||||
|
let summary = if tail.is_empty() {
|
||||||
|
"Unknown error. Check server logs for details.".to_string()
|
||||||
|
} else {
|
||||||
|
tail.join("\n")
|
||||||
|
};
|
||||||
|
return Err(bad_request(format!("Coverage command failed:\n{summary}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the coverage summary JSON
|
// Read the coverage summary JSON
|
||||||
|
|||||||
Reference in New Issue
Block a user