Example (paths generalized for clarity):
$ which cargo
$HOME/.local/bin/cargo
$ cat $(which cargo)
#!/bin/sh
case "$1" in
+*) toolchain="$1"; shift; exec rustup.cargo "$toolchain" auditable "$@" ;;
*) exec rustup.cargo auditable "$@" ;;
esac
$ cat $(which cargo-which-cargo)
#!/bin/sh
exec echo "$CARGO"
$ cargo which-cargo
$RUSTUP_HOME/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo
If a build script or cargo subcommand wants to execute a cargo command, it SHOULD be doing so by running $CARGO instead of the path cargo. As such, these will bypass the cargo wrapper.
Example (paths generalized for clarity):
If a build script or cargo subcommand wants to execute a cargo command, it SHOULD be doing so by running
$CARGOinstead of the pathcargo. As such, these will bypass the cargo wrapper.