Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix handling of `--system-specs` argument so it happens before `Application::new` (#29240)
Ben Kunkleaefb3aa2faca
diff --git a/crates/release_channel/src/lib.rs b/crates/release_channel/src/lib.rsindex 5ee840f8f1d..a53af5b93de 100644--- a/crates/release_channel/src/lib.rs+++ b/crates/release_channel/src/lib.rs@@ -63,8 +63,8 @@ impl Global for GlobalAppVersion {}pub struct AppVersion;impl AppVersion {- /// Initializes the global [`AppVersion`].- pub fn init(pkg_version: &str) -> SemanticVersion {+ /// Load the app version from env.+ pub fn load(pkg_version: &str) -> SemanticVersion {if let Ok(from_env) = env::var("ZED_APP_VERSION") {from_env.parse().expect("invalid ZED_APP_VERSION")} else {diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rsindex 56c8f2c13bb..d7edb429d02 100644--- a/crates/remote_server/src/unix.rs+++ b/crates/remote_server/src/unix.rs@@ -428,7 +428,7 @@ pub fn execute_run(let git_hosting_provider_registry = Arc::new(GitHostingProviderRegistry::new());gpui::Application::headless().run(move |cx| {settings::init(cx);- let app_version = AppVersion::init(env!("ZED_PKG_VERSION"));+ let app_version = AppVersion::load(env!("ZED_PKG_VERSION"));release_channel::init(app_version, cx);gpui_tokio::init(cx);diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 93503d739ac..731d12840fd 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -218,6 +218,20 @@ fn main() {};}+ let app_version = AppVersion::load(env!("CARGO_PKG_VERSION"));+ let app_commit_sha =+ option_env!("ZED_COMMIT_SHA").map(|commit_sha| AppCommitSha(commit_sha.to_string()));++ if args.system_specs {+ let system_specs = feedback::system_specs::SystemSpecs::new_stateless(+ app_version,+ app_commit_sha.clone(),+ *release_channel::RELEASE_CHANNEL,+ );+ println!("Zed System Specs (from CLI):\n{}", system_specs);+ return;+ }+log::info!("========== starting zed ==========");let app = Application::new().with_assets(Assets);@@ -226,9 +240,6 @@ fn main() {let installation_id = app.background_executor().block(installation_id()).ok();let session_id = Uuid::new_v4().to_string();let session = app.background_executor().block(Session::new());- let app_version = AppVersion::init(env!("CARGO_PKG_VERSION"));- let app_commit_sha =- option_env!("ZED_COMMIT_SHA").map(|commit_sha| AppCommitSha(commit_sha.to_string()));reliability::init_panic_hook(app_version,@@ -238,16 +249,6 @@ fn main() {session_id.clone(),);- if args.system_specs {- let system_specs = feedback::system_specs::SystemSpecs::new_stateless(- app_version,- app_commit_sha.clone(),- *release_channel::RELEASE_CHANNEL,- );- println!("Zed System Specs (from CLI):\n{}", system_specs);- return;- }-let (open_listener, mut open_rx) = OpenListener::new();let failed_single_instance_check =