summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-21 19:49:08 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-21 19:49:08 +0200
commite1fc51558dc14906a8d9f6a6e7bb1ac2a6ba8f3d (patch)
tree4128c9bcc4f90ef51c976d324e22a32f81c2aabe /src/evalfunc.c
parent259a90f7ce4d6d983a7fe5461da88cc52c46d9fe (diff)
patch 8.0.1742: cannot get a list of all the jobsv8.0.1742
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)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 599d61ab81..62dc40e1d7 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -682,7 +682,7 @@ static struct fst
{"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 @@ f_job_getchannel(typval_T *argvars, typval_T *rettv)
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);
}
/*