summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-04-29 16:24:38 +0200
committerBram Moolenaar <Bram@vim.org>2017-04-29 16:24:38 +0200
commit1a9020d4cba6d90688506102ab587c371ff72f8b (patch)
tree54aab7bd260a8b04c8e7ad5e372b8dc7ddaef05a
parent0635ee682481e2da0d39cd970b3cb573a1c12a17 (diff)
downloadvim-git-1a9020d4cba6d90688506102ab587c371ff72f8b.tar.gz
patch 8.0.0588: job_stop() often assumes the channel will be closedv8.0.0588
Problem: job_stop() often assumes the channel will be closed, while the job may not actually be stopped. (Martin Gammelsæter) Solution: Only assume the job stops on "kill". Don't send a signal if the job has already ended. (closes #1632)
-rw-r--r--src/channel.c9
-rw-r--r--src/version.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c
index 54a141c7d..4039b6b25 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -5148,12 +5148,17 @@ job_stop(job_T *job, typval_T *argvars)
return 0;
}
}
+ if (job->jv_status == JOB_ENDED)
+ {
+ ch_log(job->jv_channel, "Job has already ended, job_stop() skipped");
+ return 0;
+ }
ch_logs(job->jv_channel, "Stopping job with '%s'", (char *)arg);
if (mch_stop_job(job, arg) == FAIL)
return 0;
- /* Assume that "hup" does not kill the job. */
- if (job->jv_channel != NULL && STRCMP(arg, "hup") != 0)
+ /* Assume that only "kill" will kill the job. */
+ if (job->jv_channel != NULL && STRCMP(arg, "kill") == 0)
job->jv_channel->ch_job_killed = TRUE;
/* We don't try freeing the job, obviously the caller still has a
diff --git a/src/version.c b/src/version.c
index 7aae749c2..3b84b05e1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 588,
+/**/
587,
/**/
586,