GithubHelp home page GithubHelp logo

Comments (4)

epage avatar epage commented on July 30, 2024 1

I think if you removed the unwrap() and returned an error instead it would be more helpful,

The caller is wanting to assert on the result of the run, so panicing seems appropriate there. If caller needs access to the error, they should explicitly call .output().

However, you are right that we should have a custom panic! in there rather than just an unwrap.

from assert_cmd.

epage avatar epage commented on July 30, 2024 1

1.0.2 should now be released with a proper panic message

from assert_cmd.

epage avatar epage commented on July 30, 2024

at ./tests/broken_links.rs:9 // this is Command::cargo_bin, not current_dir

Pure speculation: the panic doesn't happen in current_dir but when you call asset(). Since its a single expression, the backtrace points to the first line of the expression

Using the new #[track_caller] would help in that it'd point to your code, rather than assert_cmd code, but that isn't available for trait items and we're using extension traits.

Not sure what there is that we could do at this point. Any ideas?

from assert_cmd.

jyn514 avatar jyn514 commented on July 30, 2024

It looks like the panic comes from here:

let output = self.output().unwrap();

I think if you removed the unwrap() and returned an error instead it would be more helpful, or if you want to avoid changing the API you could panic with 'failed to run the command' or something like that.

from assert_cmd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.