Skip to content

Commit

Permalink
Fix message rendering when output is redirected
Browse files Browse the repository at this point in the history
We have to manually trip the ansi escape formatting.
  • Loading branch information
celinval committed Jan 30, 2023
1 parent 4827285 commit e572b1f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kani-driver/src/call_cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl KaniSession {
print_msg(&msg.message, strip_color)?;
let _ = cargo_process.wait();
return Err(anyhow::Error::msg(msg.message).context(format!(
"Failed to compile {} due to an internal compiler error.",
"Failed to compile `{}` due to an internal compiler error.",
msg.target.name
)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
error: Crate crate_with_global_asm contains global ASM, which is not supported by Kani. Rerun with `--enable-unstable --ignore-global-asm` to suppress this error (**Verification results may be impacted**).
error: could not compile `crate_with_global_asm` due to previous error
Error: cargo exited with status exit status: 101
1 change: 0 additions & 1 deletion tests/cargo-kani/stubbing-do-not-resolve/harness.expected
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ error: unable to resolve function/method: crate::other_crate2::mock
error: unable to resolve function/method: super::other_crate2::mock
error: unable to resolve function/method: self::other_crate2::mock
error: unable to resolve function/method: other_crate1::mock
error: could not compile `stubbing-do-not-resolve` due to 4 previous errors
4 changes: 1 addition & 3 deletions tests/cargo-ui/assess-error/compilation-error/expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
error: Failed to assess project.

Caused by:\
Found 3 compilation errors.
Failed to execute cargo (exit status: 101). Found 3 compilation errors
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
error: `&str` doesn't implement `DoIt`. The function `foo` cannot be stubbed by `bar` due to generic bounds not being met.
error: `&str` doesn't implement `std::cmp::PartialEq`. The function `foo` cannot be stubbed by `bar` due to generic bounds not being met.
error: could not compile `function-stubbing-trait-mismatch` due to 2 previous errors

0 comments on commit e572b1f

Please sign in to comment.