Skip to content

Commit ea484a4

Browse files
committed
shell-wrapper: only overwrite $SHELL if it is pointing to the wrapper
1 parent 3ce6209 commit ea484a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

utils/src/shell_wrapper.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ fn real_main() -> anyhow::Result<()> {
1818
let shell = read_link(exe_dir.join("shell")).context("when locating the wrapped shell")?;
1919

2020
// Set the SHELL environment variable to the wrapped shell instead of the wrapper
21-
env::set_var("SHELL", &shell);
21+
let shell_env = env::var_os("SHELL").unwrap_or_default();
22+
if shell_env == exe {
23+
env::set_var("SHELL", &shell);
24+
}
2225

2326
// Skip if environment was already set
2427
if env::var_os("__NIXOS_SET_ENVIRONMENT_DONE") != Some("1".into()) {

0 commit comments

Comments
 (0)