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.

terminal: Remove SHLVL from terminal environment to fix incorrect shell level (#44835)

rari4046cab835003e5
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs
index caca93eac5b..e6bb454fa29 100644
--- a/crates/terminal/src/terminal.rs
+++ b/crates/terminal/src/terminal.rs
@@ -420,6 +420,10 @@ impl TerminalBuilder {
) -> Task<Result<TerminalBuilder>> {
let version = release_channel::AppVersion::global(cx);
let fut = async move {
+ // Remove SHLVL so the spawned shell initializes it to 1, matching
+ // the behavior of standalone terminal emulators like iTerm2/Kitty/Alacritty.
+ env.remove("SHLVL");
+
// If the parent environment doesn't have a locale set
// (As is the case when launched from a .app on MacOS),
// and the Project doesn't have a locale set, then