mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +00:00
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:
parent
a849db3ef4
commit
1432093dcc
8 changed files with 194 additions and 43 deletions
|
@ -51,15 +51,26 @@ impl Resolution {
|
|||
|
||||
impl ResolutionFetch {
|
||||
pub fn install(self, opts: &Options) -> Result<CrateInfo, BinstallError> {
|
||||
type InstallFp = fn(&bins::BinFile) -> Result<(), BinstallError>;
|
||||
|
||||
let (install_bin, install_link): (InstallFp, InstallFp) = match (opts.no_track, opts.force)
|
||||
{
|
||||
(true, true) | (false, _) => (bins::BinFile::install_bin, bins::BinFile::install_link),
|
||||
(true, false) => (
|
||||
bins::BinFile::install_bin_noclobber,
|
||||
bins::BinFile::install_link_noclobber,
|
||||
),
|
||||
};
|
||||
|
||||
info!("Installing binaries...");
|
||||
for file in &self.bin_files {
|
||||
file.install_bin()?;
|
||||
install_bin(file)?;
|
||||
}
|
||||
|
||||
// Generate symlinks
|
||||
if !opts.no_symlinks {
|
||||
for file in &self.bin_files {
|
||||
file.install_link()?;
|
||||
install_link(file)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +169,10 @@ impl ResolutionSource {
|
|||
cmd.arg("--root").arg(cargo_root);
|
||||
}
|
||||
|
||||
if opts.no_track {
|
||||
cmd.arg("--no-track");
|
||||
}
|
||||
|
||||
if !opts.dry_run {
|
||||
let mut child = opts
|
||||
.jobserver_client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue