diff options
-rw-r--r-- | src/nvim/os/process.c | 19 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 2 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index a1020be215..c7b473a012 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -89,21 +89,12 @@ bool os_proc_tree_kill(int pid, int sig) bool os_proc_tree_kill(int pid, int sig) { assert(sig == SIGTERM || sig == SIGKILL); - int pgid = getpgid(pid); - if (pgid > 0) { // Ignore error. Never kill self (pid=0). - if (pgid == pid) { - ILOG("sending %s to process group: -%d", - sig == SIGTERM ? "SIGTERM" : "SIGKILL", pgid); - int rv = uv_kill(-pgid, sig); - return rv == 0; - } else { - // Should never happen, because process_spawn() did setsid() in the child. - ELOG("pgid %d != pid %d", pgid, pid); - } - } else { - ELOG("getpgid(%d) returned %d", pid, pgid); + if (pid == 0) { + // Never kill self (pid=0). + return false; } - return false; + ILOG("sending %s to PID %d", sig == SIGTERM ? "SIGTERM" : "SIGKILL", -pid); + return uv_kill(-pid, sig) == 0; } #endif diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index cdff035c63..1bcf4b2891 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -797,7 +797,7 @@ describe('jobs', function() eq(ppid, info.ppid) end -- Kill the root of the tree. - funcs.jobstop(j) + eq(1, funcs.jobstop(j)) -- Assert that the children were killed. retry(nil, nil, function() for _, child_pid in ipairs(children) do |