diff options
-rw-r--r-- | src/nvim/eval.c | 5 | ||||
-rw-r--r-- | test/functional/shell/viml_system_spec.lua | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 59363a3608..fc61fed529 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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; } diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index a8bab8e26e..b36b4691b9 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -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')")) |