Skip to content

Non-zero status codes should better differentiate why (at which stage) the command failed #4379

Open
@jchlapinski

Description

At the moment, cargo only seem to support three values for status code (gathered from https://github.com/rust-lang/cargo/tree/master/tests):

  • 0 - success
  • 1 - returned when cargo verify-project is run with incorrect --manifest-path
  • 101 - failure

TL;DR:
I would like for cargo to return different non-zero status codes for at least:

  • compilation errors
  • test failures

Optionally:

  • invalid arguments, syntax errors

Reasoning:
My problem is that I need a fix for this issue: kennytm/cargo-kcov#16, where cargo kcov should generate coverage report regardless of whether the tests failed or not. This issue would be much simpler to fix if cargo returned different status code for failures during compilation stage (in which case cargo kcov needs to fail as well) and different status code if the tests failed (in which case it might continue with preparing coverage report).

I can prepare PR for cargo myself, but I would like to know if this would be acceptable change for cargo beforehand.

Regards

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-enhancementCategory: enhancementP-lowPriority: LowS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions