Skip to content

Pass full path for cargo's executable to sub-processes #3744

@lukaslueg

Description

@lukaslueg

While cargo gives build scripts the effective runtimes of rustc and rustdoc via environment
variables, programs called by cargo don't get a hint on how to call cargo itself. This is important in cases where cargo is not in $PATH or is not the one the original caller wants to use.

Cargo should provide it's own executable as an environment variable to all executables that get called by it.

A use case for this is this integration test that uses a poor man's version of cargotest in order to test a crate that ends up as a [build-dependency] in other crates: The test's executable gets called by cargo and needs to find a cargo executable to compile a free-standing test crate; this ensures that the build-script included in the crate does what it says. I currently rely on simply calling cargo and hoping for the best.

CC @alexcrichton

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-environment-variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions