mirror of
https://github.com/neovim/neovim.git
synced 2025-10-20 00:31:49 +00:00
vim-patch:8.2.4754: using cached values after unsetting some environment variables (#19872)
Problem: Still using cached values after unsetting some known environment
variables.
Solution: Take care of the side effects. (closes vim/vim#10194)
7714231bb5
Cherry-pick vim_setenv_ext() from patch 8.2.0200.
This commit is contained in:
@@ -1229,3 +1229,29 @@ bool os_shell_is_cmdexe(const char *sh)
|
||||
}
|
||||
return striequal("cmd.exe", path_tail(sh));
|
||||
}
|
||||
|
||||
/// Removes environment variable "name" and take care of side effects.
|
||||
void vim_unsetenv_ext(const char *var)
|
||||
{
|
||||
os_unsetenv(var);
|
||||
|
||||
// "homedir" is not cleared, keep using the old value until $HOME is set.
|
||||
if (STRICMP(var, "VIM") == 0) {
|
||||
didset_vim = false;
|
||||
} else if (STRICMP(var, "VIMRUNTIME") == 0) {
|
||||
didset_vimruntime = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Set environment variable "name" and take care of side effects.
|
||||
void vim_setenv_ext(const char *name, const char *val)
|
||||
{
|
||||
os_setenv(name, val, 1);
|
||||
if (STRICMP(name, "HOME") == 0) {
|
||||
init_homedir();
|
||||
} else if (didset_vim && STRICMP(name, "VIM") == 0) {
|
||||
didset_vim = false;
|
||||
} else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0) {
|
||||
didset_vimruntime = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user