Display error message on set -e PROTECTED

Previously unsetting a variable would fail silently. Now sharing error
printing code from regular `set PROTECTED` call.
This commit is contained in:
Mahmoud Al-Qudsi
2018-03-31 21:44:54 -05:00
parent abcc9647da
commit 0e0168ef18
2 changed files with 19 additions and 12 deletions

View File

@@ -1248,7 +1248,7 @@ int env_remove(const wcstring &key, int var_mode) {
int erased = 0;
if ((var_mode & ENV_USER) && is_read_only(key)) {
return 2;
return ENV_SCOPE;
}
first_node = vars_stack().top.get();