mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Use atomic_install
in install_bin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
7616546a61
commit
97bfeb7bd8
1 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ use cargo_toml::Product;
|
|||
use log::debug;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{BinstallError, PkgFmt, PkgMeta, Template};
|
||||
use crate::{atomic_install, BinstallError, PkgFmt, PkgMeta, Template};
|
||||
|
||||
pub struct BinFile {
|
||||
pub base_name: String,
|
||||
|
@ -80,11 +80,11 @@ impl BinFile {
|
|||
pub fn install_bin(&self) -> Result<(), BinstallError> {
|
||||
// TODO: check if file already exists
|
||||
debug!(
|
||||
"Copy file from '{}' to '{}'",
|
||||
"Atomically install file from '{}' to '{}'",
|
||||
self.source.display(),
|
||||
self.dest.display()
|
||||
);
|
||||
std::fs::copy(&self.source, &self.dest)?;
|
||||
atomic_install(&self.source, &self.dest)?;
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue