Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Always single-quote directory when cd'ing to get shell env (#9145)
Thorsten Ballf4a86e6feac4
diff --git a/crates/project/src/project.rs b/crates/project/src/project.rsindex fa7c8483d78..a21c864f127 100644--- a/crates/project/src/project.rs+++ b/crates/project/src/project.rs@@ -9601,7 +9601,8 @@ async fn load_shell_environment(dir: &Path) -> Result<HashMap<String, String>> {});let command = format!(- "cd {dir:?};{} echo {marker}; /usr/bin/env -0; exit 0;",+ "cd '{}';{} echo {marker}; /usr/bin/env -0; exit 0;",+ dir.display(),additional_command.unwrap_or(""));diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 23f2aa4c531..d42fadb69cb 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -848,7 +848,7 @@ async fn load_login_shell_environment() -> Result<()> {// in home directory.let shell_cmd_prefix = std::env::var_os("HOME").and_then(|home| home.into_string().ok())- .map(|home| format!("cd {home};"));+ .map(|home| format!("cd '{home}';"));// The `exit 0` is the result of hours of debugging, trying to find out// why running this command here, without `exit 0`, would mess