diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-04 07:59:32 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-04 07:59:32 +0100 |
commit | e310bbf913ba068e1669c57de255cb811422fe8b (patch) | |
tree | 5c78e70e64d660a2d7afa2b2adad2edff8ea12ca /src/nix/develop.cc | |
parent | 180984178dc4e063607f6e9e94eb2fdfedbfe452 (diff) |
Merge pull request #8043 from bobvanderlinden/pr-shell-env
nix: develop: use SHELL from rc script
(cherry picked from commit 0d55d660d5ea081630aa9606b047eb755cff1528)
Change-Id: I83be6c63b282d7f01a0defa78d9e787c77f1f02d
Diffstat (limited to 'src/nix/develop.cc')
-rw-r--r-- | src/nix/develop.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc index e9326cae9..07672a80a 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -262,7 +262,6 @@ struct Common : InstallableCommand, MixProfile "NIX_LOG_FD", "NIX_REMOTE", "PPID", - "SHELL", "SHELLOPTS", "SSL_CERT_FILE", // FIXME: only want to ignore /no-cert-file.crt "TEMP", @@ -527,7 +526,7 @@ struct CmdDevelop : Common, MixEnvironment setEnviron(); // prevent garbage collection until shell exits - setenv("NIX_GCROOT", gcroot.data(), 1); + setenv("NIX_GCROOT", gcroot.c_str(), 1); Path shell = "bash"; @@ -570,6 +569,10 @@ struct CmdDevelop : Common, MixEnvironment ignoreException(); } + // Override SHELL with the one chosen for this environment. + // This is to make sure the system shell doesn't leak into the build environment. + setenv("SHELL", shell.c_str(), 1); + // If running a phase or single command, don't want an interactive shell running after // Ctrl-C, so don't pass --rcfile auto args = phase || !command.empty() ? Strings{std::string(baseNameOf(shell)), rcFilePath} |