diff --git a/crates/fluvio-version-manager/src/command/itself/install.rs b/crates/fluvio-version-manager/src/command/itself/install.rs index c59e40065b..23cbe72d46 100644 --- a/crates/fluvio-version-manager/src/command/itself/install.rs +++ b/crates/fluvio-version-manager/src/command/itself/install.rs @@ -2,8 +2,8 @@ use std::env::current_exe; use std::fs::{copy, write, create_dir_all}; use std::path::PathBuf; +use anyhow::{anyhow, Result}; use clap::Parser; -use anyhow::Result; use crate::common::notify::Notify; use crate::common::settings::Settings; @@ -80,7 +80,14 @@ impl SelfInstallOpt { } // Copies "this" binary to the FVM binary directory - copy(current_binary_path, fvm_binary_path)?; + copy(current_binary_path.clone(), fvm_binary_path.clone()).map_err(|e| { + anyhow!( + "Couldn't copy fvm from {} to {} with error {}", + current_binary_path.display(), + fvm_binary_path.display(), + e + ) + })?; tracing::debug!( ?fvm_dir, "Copied the FVM binary to the FVM home directory with success" diff --git a/crates/fluvio-version-manager/src/common/version_installer.rs b/crates/fluvio-version-manager/src/common/version_installer.rs index a0154e5708..e03e410b40 100644 --- a/crates/fluvio-version-manager/src/common/version_installer.rs +++ b/crates/fluvio-version-manager/src/common/version_installer.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; -use std::fs::{create_dir, rename}; +use std::fs::{create_dir, copy, rename}; -use anyhow::Result; +use anyhow::{anyhow, Result}; use tempfile::TempDir; use fluvio_hub_util::fvm::{PackageSet, Download, Channel}; @@ -79,10 +79,18 @@ impl VersionInstaller { } for artif in package_set.artifacts.iter() { - rename( - tmp_dir.path().join(&artif.name), - version_path.join(&artif.name), - )?; + let src = tmp_dir.path().join(&artif.name); + let dst = version_path.join(&artif.name); + if rename(src.clone(), dst.clone()).is_err() { + copy(src.clone(), dst.clone()).map_err(|e| { + anyhow!( + "Error copying artifact {} to {}, {} ", + src.display(), + dst.display(), + e + ) + })?; + } } Ok(version_path)