dtolnay / dtolnay/anyhow

Question regarding stacktrace

Open
#353 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
6.7k
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Hello,
I have a regression in some test for a CLI using anyhow when upgrading from 1.0.75 to 1.0.80.

Here is the test:
```rust
#[sealed_test]
fn commit_fail_if_not_a_repository() -> Result<()> {
// Act
let output = Command::cargo_bin("cog")?
.arg("commit")
.arg("feat")
.arg("this is a commit message")
.arg("scope")
.output()?;

let stderr = String::from_utf8(output.stderr)?;

// Assert
let current_dir = std::env::current_dir()?;
let current_dir: &OsStr = current_dir.as_os_str();
let current_dir = current_dir.to_str().expect("utf8 error");

assert_eq!(
stderr,
formatdoc!(
"Error: failed to open repository

cause: could not find repository at '{}'; class=Repository (6); code=NotFound (-3)

",
current_dir
)
);
Ok(())
}
```
On 1.0.75, the test pass, when upgrading I now have the stacktrace displayed in stderr as well as the expected error message.
I saw there is a backstrace feature flag in anyhow, but I am not sure its related or not. Is there a way to disable this behavior ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.