summaryrefslogtreecommitdiff
path: root/src/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/job.c b/src/job.c
index f55a8cd81..5876c28cb 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1894,12 +1894,21 @@ f_job_start(typval_T *argvars, typval_T *rettv)
void
f_job_status(typval_T *argvars, typval_T *rettv)
{
- job_T *job = get_job_arg(&argvars[0]);
-
- if (job != NULL)
+ 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 *)job_status(job));
+ rettv->vval.v_string = vim_strsave((char_u *)"fail");
+ }
+ else
+ {
+ job_T *job = get_job_arg(&argvars[0]);
+
+ if (job != NULL)
+ {
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = vim_strsave((char_u *)job_status(job));
+ }
}
}