patch 8.0.1742: cannot get a list of all the jobs
Problem: Cannot get a list of all the jobs. Cannot get the command of
the job.
Solution: When job_info() is called without an argument return a list of
jobs. Otherwise, include the command that the job is running.
(Yegappan Lakshmanan)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 599d61a..62dc40e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -682,7 +682,7 @@
{"items", 1, 1, f_items},
#ifdef FEAT_JOB_CHANNEL
{"job_getchannel", 1, 1, f_job_getchannel},
- {"job_info", 1, 1, f_job_info},
+ {"job_info", 0, 1, f_job_info},
{"job_setoptions", 2, 2, f_job_setoptions},
{"job_start", 1, 2, f_job_start},
{"job_status", 1, 1, f_job_status},
@@ -7007,10 +7007,15 @@
static void
f_job_info(typval_T *argvars, typval_T *rettv)
{
- job_T *job = get_job_arg(&argvars[0]);
+ if (argvars[0].v_type != VAR_UNKNOWN)
+ {
+ job_T *job = get_job_arg(&argvars[0]);
- if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
- job_info(job, rettv->vval.v_dict);
+ if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
+ job_info(job, rettv->vval.v_dict);
+ }
+ else if (rettv_list_alloc(rettv) == OK)
+ job_info_all(rettv->vval.v_list);
}
/*