Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Check for rsync before downloading updates (#19392)

Peter Tripp47ade2f9f997
diff --git a/Cargo.lock b/Cargo.lock
index 6a94aa1a4cd..3e48e87d6f3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1009,6 +1009,7 @@ dependencies = [
"smol",
"tempfile",
"util",
+ "which 6.0.3",
"workspace",
]
diff --git a/crates/auto_update/Cargo.toml b/crates/auto_update/Cargo.toml
index 1e08c9a768b..d47a9f9ae07 100644
--- a/crates/auto_update/Cargo.toml
+++ b/crates/auto_update/Cargo.toml
@@ -32,4 +32,5 @@ settings.workspace = true
smol.workspace = true
tempfile.workspace = true
util.workspace = true
+which.workspace = true
workspace.workspace = true
diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs
index d501e6d93fd..fc4bef90a7b 100644
--- a/crates/auto_update/src/auto_update.rs
+++ b/crates/auto_update/src/auto_update.rs
@@ -33,6 +33,7 @@ use std::{
};
use update_notification::UpdateNotification;
use util::ResultExt;
+use which::which;
use workspace::notifications::NotificationId;
use workspace::Workspace;
@@ -560,6 +561,12 @@ impl AutoUpdater {
"linux" => Ok("zed.tar.gz"),
_ => Err(anyhow!("not supported: {:?}", OS)),
}?;
+
+ anyhow::ensure!(
+ which("rsync").is_ok(),
+ "Aborting. Could not find rsync which is required for auto-updates."
+ );
+
let downloaded_asset = temp_dir.path().join(filename);
download_release(&downloaded_asset, release, client, &cx).await?;