Prefer the binary's version when checking if it's up to date (#13840)

Fixes #13741
This commit is contained in:
Aria Desires 2025-06-04 11:32:59 -04:00 committed by GitHub
parent a748336a09
commit d8636a4088
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,6 +63,14 @@ pub(crate) async fn self_update(
return Ok(ExitStatus::Error);
};
// If we know what our version is, ignore whatever the receipt thinks it is!
// This makes us behave better if someone manually installs a random version of uv
// in a way that doesn't update the receipt.
if let Ok(version) = env!("CARGO_PKG_VERSION").parse() {
// This is best-effort, it's fine if it fails (also it can't actually fail)
let _ = updater.set_current_version(version);
}
// Ensure the receipt is for the current binary. If it's not, then the user likely has multiple
// uv binaries installed, and the current binary was _not_ installed via the standalone
// installation scripts.