diff options
author | Lino Le Van <11367844+lino-levan@users.noreply.github.com> | 2022-12-08 14:48:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-08 17:48:48 -0500 |
commit | a9d2154110e212bfc4ed26008a948b9209212b6d (patch) | |
tree | 3a5bdfe251ee2d66ccfc73e37ddb3a955ee1cc8c /cli/tools/upgrade.rs | |
parent | 01afb672e12c7ef3fe1cc09330aa26ca4a29b699 (diff) |
fix(cli/upgrade): properly cleanup after finished (#16930)
Co-authored-by: kidonng <kidonng@users.noreply.github.com>
Diffstat (limited to 'cli/tools/upgrade.rs')
-rw-r--r-- | cli/tools/upgrade.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index 8c987e82c..cb155d716 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -377,6 +377,8 @@ pub async fn upgrade(upgrade_flags: UpgradeFlags) -> Result<(), AnyError> { return Err(err.into()); } } + } else { + fs::remove_file(&new_exe_path)?; } log::info!("Upgraded successfully"); @@ -520,7 +522,7 @@ pub fn unpack( fs::write(&archive_path, &archive_data)?; Command::new("unzip") .current_dir(&temp_dir) - .arg(archive_path) + .arg(&archive_path) .spawn() .map_err(|err| { if err.kind() == std::io::ErrorKind::NotFound { @@ -538,6 +540,7 @@ pub fn unpack( }; assert!(unpack_status.success()); assert!(exe_path.exists()); + fs::remove_file(&archive_path)?; Ok(exe_path) } |