diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-03-11 21:46:14 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-03-16 10:55:12 +0100 |
commit | de86f824835b1556cc0070dd5720cdae484a0296 (patch) | |
tree | 8c37fd5de913b92f55a6bb597bd89788bac7ea08 /src/nvim/event/process.c | |
parent | 8d90171f8be6b92d7186ca84c42a0e07c2c71908 (diff) | |
download | rneovim-de86f824835b1556cc0070dd5720cdae484a0296.tar.gz rneovim-de86f824835b1556cc0070dd5720cdae484a0296.tar.bz2 rneovim-de86f824835b1556cc0070dd5720cdae484a0296.zip |
win: os_proc_tree_kill()
XXX: comment at https://stackoverflow.com/q/1173342 :
> Windows recycles PIDs quite fast, you have to be extra careful not
> to kill unrelated processes. These APIs will report PPIDs for long
> dead processes whose PIDs may have been recycled. Check the parent
> start date to make sure it is related to the processes you spawned.
Diffstat (limited to 'src/nvim/event/process.c')
-rw-r--r-- | src/nvim/event/process.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 78ef253d8b..60650344ce 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -12,6 +12,7 @@ #include "nvim/event/wstream.h" #include "nvim/event/process.h" #include "nvim/event/libuv_process.h" +#include "nvim/os/process.h" #include "nvim/os/pty_process.h" #include "nvim/globals.h" #include "nvim/macros.h" @@ -201,23 +202,6 @@ int process_wait(Process *proc, int ms, MultiQueue *events) return proc->status; } -/// Kills a process and its descendants. -static void 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); - uv_kill(-pgid, sig); - } else { - // Should never happen, because process_spawn() did setsid() in the child. - ELOG("pgid %d != pid %d", pgid, pid); - } - } -} - /// Ask a process to terminate and eventually kill if it doesn't respond void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL { |