Mercurial > vim
changeset 11408:c9924ea60cc7 v8.0.0588
patch 8.0.0588: job_stop() often assumes the channel will be closed
commit https://github.com/vim/vim/commit/1a9020d4cba6d90688506102ab587c371ff72f8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 29 16:24:38 2017 +0200
patch 8.0.0588: job_stop() often assumes the channel will be closed
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 29 Apr 2017 16:30:03 +0200 |
parents | cc5253681167 |
children | 7b39aa183f2e |
files | src/channel.c src/version.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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