Mercurial > vim
changeset 19087:e3848b251a01 v8.2.0104
patch 8.2.0104: using channel or job with ":execute" has strange effects
Commit: https://github.com/vim/vim/commit/b662591e505e8523634a1c8ddfb7fe44fae880c6
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 8 20:09:01 2020 +0100
patch 8.2.0104: using channel or job with ":execute" has strange effects
Problem: Using channel or job with ":execute" has strange effects.
Solution: Give an error message for Job and Channel.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 08 Jan 2020 20:15:03 +0100 |
parents | 8225fdd8fe14 |
children | 74589f7c03e8 |
files | src/eval.c src/testdir/test_eval_stuff.vim src/version.c |
diffstat | 3 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -6055,7 +6055,15 @@ ex_execute(exarg_T *eap) char_u buf[NUMBUFLEN]; if (eap->cmdidx == CMD_execute) - p = tv_get_string_buf(&rettv, buf); + { + if (rettv.v_type == VAR_CHANNEL || rettv.v_type == VAR_JOB) + { + emsg(_(e_inval_string)); + p = NULL; + } + else + p = tv_get_string_buf(&rettv, buf); + } else p = tv_stringify(&rettv, buf); if (p == NULL)
--- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -216,3 +216,15 @@ func Test_scriptversion_fail() call assert_fails('source Xversionscript', 'E999:') call delete('Xversionscript') endfunc + +func Test_excute_null() + call assert_fails('execute test_null_list()', 'E730:') + call assert_fails('execute test_null_dict()', 'E731:') + call assert_fails('execute test_null_blob()', 'E976:') + execute test_null_string() + call assert_fails('execute test_null_partial()', 'E729:') + if has('job') + call assert_fails('execute test_null_job()', 'E908:') + call assert_fails('execute test_null_channel()', 'E908:') + endif +endfunc