Skip to content

Commit 1a9020d

Browse files
committed
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)
1 parent 0635ee6 commit 1a9020d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/channel.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5148,12 +5148,17 @@ job_stop(job_T *job, typval_T *argvars)
51485148
return 0;
51495149
}
51505150
}
5151+
if (job->jv_status == JOB_ENDED)
5152+
{
5153+
ch_log(job->jv_channel, "Job has already ended, job_stop() skipped");
5154+
return 0;
5155+
}
51515156
ch_logs(job->jv_channel, "Stopping job with '%s'", (char *)arg);
51525157
if (mch_stop_job(job, arg) == FAIL)
51535158
return 0;
51545159

5155-
/* Assume that "hup" does not kill the job. */
5156-
if (job->jv_channel != NULL && STRCMP(arg, "hup") != 0)
5160+
/* Assume that only "kill" will kill the job. */
5161+
if (job->jv_channel != NULL && STRCMP(arg, "kill") == 0)
51575162
job->jv_channel->ch_job_killed = TRUE;
51585163

51595164
/* We don't try freeing the job, obviously the caller still has a

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
588,
767769
/**/
768770
587,
769771
/**/

0 commit comments

Comments
 (0)