Skip to content

Commit b662591

Browse files
committed
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.
1 parent e2a8f07 commit b662591

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/eval.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6055,7 +6055,15 @@ ex_execute(exarg_T *eap)
60556055
char_u buf[NUMBUFLEN];
60566056

60576057
if (eap->cmdidx == CMD_execute)
6058-
p = tv_get_string_buf(&rettv, buf);
6058+
{
6059+
if (rettv.v_type == VAR_CHANNEL || rettv.v_type == VAR_JOB)
6060+
{
6061+
emsg(_(e_inval_string));
6062+
p = NULL;
6063+
}
6064+
else
6065+
p = tv_get_string_buf(&rettv, buf);
6066+
}
60596067
else
60606068
p = tv_stringify(&rettv, buf);
60616069
if (p == NULL)

src/testdir/test_eval_stuff.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,15 @@ func Test_scriptversion_fail()
216216
call assert_fails('source Xversionscript', 'E999:')
217217
call delete('Xversionscript')
218218
endfunc
219+
220+
func Test_excute_null()
221+
call assert_fails('execute test_null_list()', 'E730:')
222+
call assert_fails('execute test_null_dict()', 'E731:')
223+
call assert_fails('execute test_null_blob()', 'E976:')
224+
execute test_null_string()
225+
call assert_fails('execute test_null_partial()', 'E729:')
226+
if has('job')
227+
call assert_fails('execute test_null_job()', 'E908:')
228+
call assert_fails('execute test_null_channel()', 'E908:')
229+
endif
230+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
104,
745747
/**/
746748
103,
747749
/**/

0 commit comments

Comments
 (0)