mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.1857: Vim9: using job_status() on an unused var gives an error
Problem: Vim9: using job_status() on an unused var gives an error. Solution: Return "fail". (closes #7158)
This commit is contained in:
@@ -1893,6 +1893,14 @@ f_job_start(typval_T *argvars, typval_T *rettv)
|
||||
*/
|
||||
void
|
||||
f_job_status(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
if (argvars[0].v_type == VAR_JOB && argvars[0].vval.v_job == NULL)
|
||||
{
|
||||
// A job that never started returns "fail".
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = vim_strsave((char_u *)"fail");
|
||||
}
|
||||
else
|
||||
{
|
||||
job_T *job = get_job_arg(&argvars[0]);
|
||||
|
||||
@@ -1902,6 +1910,7 @@ f_job_status(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_string = vim_strsave((char_u *)job_status(job));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* "job_stop()" function
|
||||
|
@@ -74,7 +74,11 @@ def Test_assignment()
|
||||
|
||||
if has('channel')
|
||||
var chan1: channel
|
||||
assert_equal('fail', ch_status(chan1))
|
||||
|
||||
var job1: job
|
||||
assert_equal('fail', job_status(job1))
|
||||
|
||||
# calling job_start() is in test_vim9_fails.vim, it causes leak reports
|
||||
endif
|
||||
if has('float')
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1857,
|
||||
/**/
|
||||
1856,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user