]> granicus.if.org Git - vim/commitdiff
patch 8.2.0104: using channel or job with ":execute" has strange effects v8.2.0104
authorBram Moolenaar <Bram@vim.org>
Wed, 8 Jan 2020 19:09:01 +0000 (20:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 8 Jan 2020 19:09:01 +0000 (20:09 +0100)
Problem:    Using channel or job with ":execute" has strange effects.
Solution:   Give an error message for Job and Channel.

src/eval.c
src/testdir/test_eval_stuff.vim
src/version.c

index e0f27a0986451c07afbe681431c700a37d2b10a9..f8ba4dffa0dd169ba0fc763c39d1ff8aa7b766de 100644 (file)
@@ -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)
index ec566da04a3eae871ba32c4f9679952c8eb6d2c9..53627557a05d3cc135fb0eb65f816baa249442d3 100644 (file)
@@ -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
index 54104ebac2c781b4eb4395c5458167af2f75ad9f..3362ab5b542048090c5e4ec033fa3f12cc4d1ac8 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    104,
 /**/
     103,
 /**/