]> git.proxmox.com Git - cargo.git/commit
Auto merge of #11023 - dpc:cargo-cmd-path-order, r=epage
authorbors <bors@rust-lang.org>
Tue, 13 Sep 2022 15:09:18 +0000 (15:09 +0000)
committerbors <bors@rust-lang.org>
Tue, 13 Sep 2022 15:09:18 +0000 (15:09 +0000)
commitc1871146e3f5f5f5913a3ef93ca176b062d7ff3e
treef128e2c79d3734be41a7ae7363ec6dca4d7e697a
parent0eac8be633e5fdbd93ee31a8ffaada74e637a046
parentc712f088626bc3a81fdf35a3ef726124c2faa6fd
Auto merge of #11023 - dpc:cargo-cmd-path-order, r=epage

Do not add home bin path to PATH if it's already there

This is to allow users to control the order via PATH if they so desire.

Tested by preparing two different `cargo-foo` scripts in `$HOME/.cargo/bin` and `$HOME/bin`:

```
> env PATH="/usr/bin/:$HOME/bin:$HOME/.cargo/bin" ./target/debug/cargo foo
Inside ~/bin/
> env PATH="$HOME/.cargo/bin:/usr/bin/:$HOME/bin" ./target/debug/cargo foo
Inside ~/.cargo/bin/
> env PATH="/usr/bin/:$HOME/bin" ./target/debug/cargo foo
Inside ~/.cargo/bin/
```

and trailing slash:

```
> env PATH="$HOME/.cargo/bin/:/usr/bin/:$HOME/bin" ./target/debug/cargo foo
Inside ~/.cargo/bin/
> env PATH="/usr/bin/:$HOME/bin:$HOME/.cargo/bin/" ./target/debug/cargo foo
Inside ~/bin/
```

Fix https://github.com/rust-lang/cargo/issues/11020