mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-25 23:15:51 +08:00
fix(core): clean up the displaced core after a failed upgrade restart
Windows publishes the core by moving the running binary aside, and only the success path could delete it afterwards. A failed restart left it on disk, and the uninstaller did not know about it either.
This commit is contained in:
@@ -99,6 +99,11 @@ pub async fn upgrade_core(force: bool) -> Result<CoreUpgradeReport> {
|
||||
}
|
||||
// Renaming one hard link over the other succeeds without consuming the name.
|
||||
let _ = std::fs::remove_file(&rollback);
|
||||
// Redundant once the rollback link exists; without one it is the only copy left.
|
||||
#[cfg(windows)]
|
||||
if restorable {
|
||||
let _ = std::fs::remove_file(target.with_extension("old"));
|
||||
}
|
||||
return Err(error);
|
||||
}
|
||||
let _ = std::fs::remove_file(&rollback);
|
||||
|
||||
Reference in New Issue
Block a user