mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 22:14:53 +00:00
Recalculate exported variables when universal variable is erased
Fixes #2046
This commit is contained in:
parent
9c3a9a1e73
commit
f30872a7b5
2 changed files with 8 additions and 0 deletions
4
env.cpp
4
env.cpp
|
@ -901,6 +901,7 @@ int env_remove(const wcstring &key, int var_mode)
|
||||||
!(var_mode & ENV_GLOBAL) &&
|
!(var_mode & ENV_GLOBAL) &&
|
||||||
!(var_mode & ENV_LOCAL))
|
!(var_mode & ENV_LOCAL))
|
||||||
{
|
{
|
||||||
|
bool is_exported = uvars()->get_export(key);
|
||||||
erased = uvars() && uvars()->remove(key);
|
erased = uvars() && uvars()->remove(key);
|
||||||
if (erased)
|
if (erased)
|
||||||
{
|
{
|
||||||
|
@ -911,6 +912,9 @@ int env_remove(const wcstring &key, int var_mode)
|
||||||
ev.arguments.push_back(key);
|
ev.arguments.push_back(key);
|
||||||
event_fire(&ev);
|
event_fire(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_exported)
|
||||||
|
mark_changed_exported();
|
||||||
}
|
}
|
||||||
|
|
||||||
react_to_variable_change(key);
|
react_to_variable_change(key);
|
||||||
|
|
|
@ -149,6 +149,10 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
set -Ue __fish_test_universal_variables_variable_foo
|
set -Ue __fish_test_universal_variables_variable_foo
|
||||||
|
|
||||||
|
# Should no longer be in environment (#2046)
|
||||||
|
env | sgrep __fish_test_universal_variables_variable_foo
|
||||||
|
|
||||||
set -Ux __fish_test_universal_variables_variable_foo bar
|
set -Ux __fish_test_universal_variables_variable_foo bar
|
||||||
set -U __fish_test_universal_variables_variable_foo baz
|
set -U __fish_test_universal_variables_variable_foo baz
|
||||||
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = baz -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = baz
|
if test (/bin/sh -c 'echo $__fish_test_universal_variables_variable_foo') = baz -a (../fish -c 'echo $__fish_test_universal_variables_variable_foo') = baz
|
||||||
|
|
Loading…
Reference in a new issue