mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-17 19:21:15 -03:00
Add and use new exit code for env_remove() when var doesn't exist
The previous commit caused the tests to fail since env_remove() was returning a blanket `!0` when a variable couldn't be unset because it didn't exist in the first place. This caused the wrong message to be emitted since the code clashed with a return code for `env_set()`. Added `ENV_NOT_FOUND` to signify that the variable requested unset didn't exist in the first place, but _not_ printing the error message currently so as not to break existing behavior before checking if this is something we want.
This commit is contained in:
@@ -1286,7 +1286,7 @@ int env_remove(const wcstring &key, int var_mode) {
|
||||
|
||||
react_to_variable_change(L"ERASE", key);
|
||||
|
||||
return !erased;
|
||||
return erased ? ENV_OK : ENV_NOT_FOUND;
|
||||
}
|
||||
|
||||
const wcstring_list_t &env_var_t::as_list() const { return vals; }
|
||||
|
||||
Reference in New Issue
Block a user