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:
Mahmoud Al-Qudsi
2018-03-31 22:12:52 -05:00
parent 0e0168ef18
commit 01452da5bf
3 changed files with 13 additions and 4 deletions

View File

@@ -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; }