mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
fix(cli/upgrade): properly cleanup after finished (#16930)
Co-authored-by: kidonng <kidonng@users.noreply.github.com>
This commit is contained in:
parent
01afb672e1
commit
a9d2154110
1 changed files with 4 additions and 1 deletions
|
@ -377,6 +377,8 @@ pub async fn upgrade(upgrade_flags: UpgradeFlags) -> Result<(), AnyError> {
|
||||||
return Err(err.into());
|
return Err(err.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fs::remove_file(&new_exe_path)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("Upgraded successfully");
|
log::info!("Upgraded successfully");
|
||||||
|
@ -520,7 +522,7 @@ pub fn unpack(
|
||||||
fs::write(&archive_path, &archive_data)?;
|
fs::write(&archive_path, &archive_data)?;
|
||||||
Command::new("unzip")
|
Command::new("unzip")
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&temp_dir)
|
||||||
.arg(archive_path)
|
.arg(&archive_path)
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if err.kind() == std::io::ErrorKind::NotFound {
|
if err.kind() == std::io::ErrorKind::NotFound {
|
||||||
|
@ -538,6 +540,7 @@ pub fn unpack(
|
||||||
};
|
};
|
||||||
assert!(unpack_status.success());
|
assert!(unpack_status.success());
|
||||||
assert!(exe_path.exists());
|
assert!(exe_path.exists());
|
||||||
|
fs::remove_file(&archive_path)?;
|
||||||
Ok(exe_path)
|
Ok(exe_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue