mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
vim-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 vim/vim#3656)
76ab4fd619
Ref: https://github.com/neovim/neovim/issues/9704
Ref: https://github.com/neovim/neovim/issues/10182#issuecomment-514450069
Closes https://github.com/neovim/neovim/pull/10660
This commit is contained in:
parent
da87b67812
commit
6e01ed6a4c
@ -89,22 +89,13 @@ 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;
|
||||
}
|
||||
ILOG("sending %s to PID %d", sig == SIGTERM ? "SIGTERM" : "SIGKILL", -pid);
|
||||
return uv_kill(-pid, sig) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Gets the process ids of the immediate children of process `ppid`.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user