]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0588: job_stop() often assumes the channel will be closed v8.0.0588
authorBram Moolenaar <Bram@vim.org>
Sat, 29 Apr 2017 14:24:38 +0000 (16:24 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 29 Apr 2017 14:24:38 +0000 (16:24 +0200)
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)

src/channel.c
src/version.c

index 54a141c7d6d224b3159b1bf6397608fe27e2b11b..4039b6b25d977e6ef2c8fcedb5ebee29a2f03bb1 100644 (file)
@@ -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
index 7aae749c284b77c07ab1e26ae2361710538ba133..3b84b05e154f197b71b96529ebf039d9f1baacc2 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    588,
 /**/
     587,
 /**/