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.

util: Respect user-defined SHELL environment variable (#40181)

Xiaobo Liu9d2352766338
diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs
index c469ddcce3b..3f1205f9653 100644
--- a/crates/util/src/util.rs
+++ b/crates/util/src/util.rs
@@ -279,7 +279,11 @@ fn load_shell_from_passwd() -> Result<()> {
);
let shell = unsafe { std::ffi::CStr::from_ptr(entry.pw_shell).to_str().unwrap() };
- if env::var("SHELL").map_or(true, |shell_env| shell_env != shell) {
+ let should_set_shell = env::var("SHELL").map_or(true, |shell_env| {
+ shell_env != shell && !std::path::Path::new(&shell_env).exists()
+ });
+
+ if should_set_shell {
log::info!(
"updating SHELL environment variable to value from passwd entry: {:?}",
shell,