feat: Add new cmdline option --no-track (#1111)

Same as `cargo-install`'s `--no-track`.
It is also passed to `cargo-install` if it is invoked.

Also fixed `fs::atomic_symlink_file` which on Windows could fallback to
non-atomic install if symlinking failed.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-06-03 19:15:18 +10:00 committed by GitHub
parent a849db3ef4
commit 1432093dcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 194 additions and 43 deletions

28
e2e-tests/no-track.sh Normal file
View file

@ -0,0 +1,28 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export CARGO_HOME
export PATH="$CARGO_HOME/bin:$PATH"
"./$1" binstall -y cargo-binstall@0.20.1
cargo-binstall --help >/dev/null
set +e
"./$1" binstall -y --no-track cargo-binstall@0.20.1
exit_code="$?"
set -e
if [ "$exit_code" != 74 ]; then
echo "Expected exit code 74 Io Error, but actual exit code $exit_code"
exit 1
fi
"./$1" binstall -y --no-track --force cargo-binstall@0.20.1
cargo-binstall --help >/dev/null