Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix `Failed to load environment variables` error message after self-update on Linux (#46367)
Martin Pool271bcf65ef87
diff --git a/crates/util/src/util.rs b/crates/util/src/util.rsindex 9b099f04983..87b8a1615d8 100644--- a/crates/util/src/util.rs+++ b/crates/util/src/util.rs@@ -304,8 +304,19 @@ fn load_shell_from_passwd() -> Result<()> {/// Returns a shell escaped path for the current zed executablepub fn get_shell_safe_zed_path(shell_kind: shell::ShellKind) -> anyhow::Result<String> {- let zed_path =+ let mut zed_path =std::env::current_exe().context("Failed to determine current zed executable path.")?;+ if cfg!(target_os = "linux")+ && !zed_path.is_file()+ && let Some(truncated) = zed_path+ .clone()+ .file_name()+ .and_then(|s| s.to_str())+ .and_then(|n| n.strip_suffix(" (deleted)"))+ {+ // Might have been deleted during update; let's use the new binary if there is one.+ zed_path.set_file_name(truncated);+ }zed_path.try_shell_safe(shell_kind)