Mercurial > vim
changeset 15123:7d2ed364a8a0 v8.1.0572
patch 8.1.0572: stopping a job does not work properly on OpenBSD
commit https://github.com/vim/vim/commit/76ab4fd61901090e6af3451ca6c5ca0fc370571f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 8 14:39:05 2018 +0100
patch 8.1.0572: stopping a job does not work properly on OpenBSD
Problem: Stopping a job does not work properly on OpenBSD.
Solution: Do not use getpgid() to check the process group of the job
processs ID, always pass the negative process ID to kill().
(George Koehler, closes #3656)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Dec 2018 14:45:05 +0100 |
parents | 91fafb38608c |
children | 27c801cca007 |
files | src/os_unix.c src/version.c |
diffstat | 2 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -5820,7 +5820,6 @@ mch_detect_ended_job(job_T *job_list) mch_signal_job(job_T *job, char_u *how) { int sig = -1; - pid_t job_pid; if (*how == NUL || STRCMP(how, "term") == 0) sig = SIGTERM; @@ -5841,16 +5840,13 @@ mch_signal_job(job_T *job, char_u *how) else return FAIL; - /* TODO: have an option to only kill the process, not the group? */ - job_pid = job->jv_pid; -#ifdef HAVE_GETPGID - if (job_pid == getpgid(job_pid)) - job_pid = -job_pid; -#endif - - /* Never kill ourselves! */ - if (job_pid != 0) - kill(job_pid, sig); + // Never kill ourselves! + if (job->jv_pid != 0) + { + // TODO: have an option to only kill the process, not the group? + kill(-job->jv_pid, sig); + kill(job->jv_pid, sig); + } return OK; }