linux: Store binary path before restart to handle deleted binary file (#11568)

This fixes restart after updates not working on Linux.

On Linux we can't reliably get the binary path after an update, because
the original binary was deleted and the path will contain ` (deleted)`.

See: https://github.com/rust-lang/rust/issues/69343

We *could* strip ` (deleted)` off, but that feels nasty. So instead we
save the original binary path, before we do the installation, then
restart.

Later on, we can also change this to be a _new_ binary path returned by
the installers, which we then have to start.


Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-05-08 19:13:28 +02:00 committed by GitHub
parent d2cec0221b
commit dbebb40956
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 49 additions and 25 deletions

View file

@ -677,7 +677,7 @@ impl CollabTitlebarItem {
client::Status::UpgradeRequired => {
let auto_updater = auto_update::AutoUpdater::get(cx);
let label = match auto_updater.map(|auto_update| auto_update.read(cx).status()) {
Some(AutoUpdateStatus::Updated) => "Please restart Zed to Collaborate",
Some(AutoUpdateStatus::Updated { .. }) => "Please restart Zed to Collaborate",
Some(AutoUpdateStatus::Installing)
| Some(AutoUpdateStatus::Downloading)
| Some(AutoUpdateStatus::Checking) => "Updating...",
@ -691,7 +691,7 @@ impl CollabTitlebarItem {
.label_size(LabelSize::Small)
.on_click(|_, cx| {
if let Some(auto_updater) = auto_update::AutoUpdater::get(cx) {
if auto_updater.read(cx).status() == AutoUpdateStatus::Updated {
if auto_updater.read(cx).status().is_updated() {
workspace::restart(&Default::default(), cx);
return;
}