diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-08 20:09:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-08 20:09:01 +0100 |
commit | b662591e505e8523634a1c8ddfb7fe44fae880c6 (patch) | |
tree | 2a3b6f799e6de32ebde775ebb76f366060617779 | |
parent | e2a8f0773e91685843c062b1e48259712d5f2213 (diff) | |
download | vim-git-b662591e505e8523634a1c8ddfb7fe44fae880c6.tar.gz |
patch 8.2.0104: using channel or job with ":execute" has strange effectsv8.2.0104
Problem: Using channel or job with ":execute" has strange effects.
Solution: Give an error message for Job and Channel.
-rw-r--r-- | src/eval.c | 10 | ||||
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index e0f27a098..f8ba4dffa 100644 --- 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) diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index ec566da04..53627557a 100644 --- 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 diff --git a/src/version.c b/src/version.c index 54104ebac..3362ab5b5 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 104, +/**/ 103, /**/ 102, |