project: Use login shell to get environment per project (#17717)

This is a follow-up to #17075 to spawn a login shell when getting the
environment for projects.

The reason why we didn't do it before is that we only used the
environment for certain language servers and not a lot of other things,
like tasks.

But with #17075 we now use the project more often and use it as the
_base_ environment for tasks/terminals.

Before the change, terminals and tasks would inherit the Zed process'
environment, including PATH and so on. After the change, we would set
the environment, overwriting the PATH instead of merging. But the
non-login shell environment is a subset of the login-shell environment.


Release Notes:

- Fixed environment variables used per project in terminals/tasks
overwriting the base environment and not making use of a login-shell
environment.
This commit is contained in:
Thorsten Ball 2024-09-11 13:33:42 -04:00 committed by GitHub
parent b5c42edf1e
commit 9407d86ce6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,7 +219,7 @@ async fn load_shell_environment(
);
let output = smol::process::Command::new(&shell)
.args(["-i", "-c", &command])
.args(["-l", "-i", "-c", &command])
.envs(direnv_environment)
.output()
.await