From 257fb0f50fe2d9c40476c698c5d033ee390c7ce7 Mon Sep 17 00:00:00 2001 From: Sid-Ali <9877335+sidalit@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:00:56 -0500 Subject: [PATCH] fix(terminal): respect shell environment opt-out (#1903) OPENIDEA_SKIP_SHELL_ENV already stops the IDE importing the login-shell environment; the integrated terminal now also skips its implicit login argument (-l) when it is set, so login profiles don't overwrite the inherited PATH. Explicit shell arguments still win; default behaviour is unchanged. Co-authored-by: sidalit <98773335+sidalit@users.noreply.github.com> --- crates/ide-terminal/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ide-terminal/src/lib.rs b/crates/ide-terminal/src/lib.rs index c53426a54..26d7fe3c9 100644 --- a/crates/ide-terminal/src/lib.rs +++ b/crates/ide-terminal/src/lib.rs @@ -558,13 +558,15 @@ pub fn available_shells() -> Vec { /// argument-less) POSIX shell is started as a login shell, like Terminal.app, /// the Git Bash shortcut and IDEA: login start-up is what loads the completions /// and prompts users expect (`/etc/profile`, Git for Windows' git-completion). +/// `OPENIDEA_SKIP_SHELL_ENV` disables the implicit login argument; explicit +/// arguments still take precedence, and interactive startup files still run. pub fn resolve_shell(shell: Option<&str>, args: &[String]) -> (String, Vec) { let shell = shell.map(str::trim).filter(|s| !s.is_empty()).map(str::to_owned).unwrap_or_else(default_shell); if !args.is_empty() { return (shell, args.to_vec()); } - let login = - matches!(shell_title(&shell).as_str(), "zsh" | "bash" | "sh" | "fish" | "ksh" | "dash" | "tcsh" | "csh"); + let login = std::env::var_os("OPENIDEA_SKIP_SHELL_ENV").is_none() + && matches!(shell_title(&shell).as_str(), "zsh" | "bash" | "sh" | "fish" | "ksh" | "dash" | "tcsh" | "csh"); let args = if login { vec!["-l".to_owned()] } else { Vec::new() }; (shell, args) }