eval: Return an empty list from systemlist() when there's no output

This is the behavior on vim's `systemlist()`.
This commit is contained in:
Thiago de Arruda 2014-11-10 08:07:16 -03:00
parent 63a98fca55
commit ab826d88f6
2 changed files with 6 additions and 1 deletions

View File

@ -14492,6 +14492,11 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv,
set_vim_var_nr(VV_SHELL_ERROR, (long) status);
if (res == NULL) {
if (retlist) {
// return an empty list when there's no output
rettv->v_type = VAR_LIST;
rettv->vval.v_list = list_alloc();
}
return;
}

View File

@ -166,7 +166,7 @@ describe('systemlist()', function()
if xclip then
describe("with a program that doesn't close stdout", function()
it('will exit properly after passing input', function()
eq(nil, eval(
eq({}, eval(
"systemlist('xclip -i -selection clipboard', ['clip', 'data'])"))
eq({'clip', 'data'}, eval(
"systemlist('xclip -o -selection clipboard')"))