fix set --show of semi-empty var

A semi-empty var is one with a single empty string element. The
`env_var_t::empty()` method returns true for such vars but we want
`set --show` to report that it has a single empty element.
This commit is contained in:
Kurtis Rader 2017-08-16 13:19:17 -07:00
parent 64eaf7ca5a
commit dbb07bc3f5

View file

@ -330,7 +330,7 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
const env_var_t var = env_get_string(var_name, scope | ENV_USER); const env_var_t var = env_get_string(var_name, scope | ENV_USER);
wcstring_list_t result; wcstring_list_t result;
if (!var.empty()) tokenize_variable_array(var, result); tokenize_variable_array(var, result);
streams.out.append_format(_(L"$%ls: set in %ls scope, %ls, with %d elements\n"), var_name, streams.out.append_format(_(L"$%ls: set in %ls scope, %ls, with %d elements\n"), var_name,
scope_name, exportv, result.size()); scope_name, exportv, result.size());