aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-03-18 18:36:02 +0100
committerGitHub <noreply@github.com>2018-03-18 18:36:02 +0100
commit4e02f1ab871f30d80250537877924d522497493b (patch)
tree0a054babaa09767e5c31d7f485a7901e29188b35 /src/nvim/event
parent0848add4885adaa61218cc5394dc23d92c5812df (diff)
parentae409b5042abdbec67305a063cf921ddffcce0c8 (diff)
downloadrneovim-4e02f1ab871f30d80250537877924d522497493b.tar.gz
rneovim-4e02f1ab871f30d80250537877924d522497493b.tar.bz2
rneovim-4e02f1ab871f30d80250537877924d522497493b.zip
Merge #8107 'jobs: separate process-group'
Diffstat (limited to 'src/nvim/event')
-rw-r--r--src/nvim/event/libuv_process.c9
-rw-r--r--src/nvim/event/process.c14
2 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c
index c101cb1bb9..0c2bf397e5 100644
--- a/src/nvim/event/libuv_process.c
+++ b/src/nvim/event/libuv_process.c
@@ -26,15 +26,18 @@ int libuv_process_spawn(LibuvProcess *uvproc)
uvproc->uvopts.file = proc->argv[0];
uvproc->uvopts.args = proc->argv;
uvproc->uvopts.flags = UV_PROCESS_WINDOWS_HIDE;
- if (proc->detach) {
- uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
- }
#ifdef WIN32
// libuv collapses the argv to a CommandLineToArgvW()-style string. cmd.exe
// expects a different syntax (must be prepared by the caller before now).
if (os_shell_is_cmdexe(proc->argv[0])) {
uvproc->uvopts.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS;
}
+ if (proc->detach) {
+ uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
+ }
+#else
+ // Always setsid() on unix-likes. #8107
+ uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
#endif
uvproc->uvopts.exit_cb = exit_cb;
uvproc->uvopts.cwd = proc->cwd;
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index a06f5f4ff3..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"
@@ -215,8 +216,7 @@ void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL
// stdout/stderr, they will be closed when it exits(possibly due to being
// terminated after a timeout)
stream_may_close(&proc->in);
- ILOG("Sending SIGTERM to pid %d", proc->pid);
- uv_kill(proc->pid, SIGTERM);
+ os_proc_tree_kill(proc->pid, SIGTERM);
break;
case kProcessTypePty:
// close all streams for pty processes to send SIGHUP to the process
@@ -231,7 +231,7 @@ void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL
if (!loop->children_stop_requests++) {
// When there's at least one stop request pending, start a timer that
// will periodically check if a signal should be send to the job.
- ILOG("Starting job kill timer");
+ ILOG("starting job kill timer");
uv_timer_start(&loop->children_kill_timer, children_kill_cb,
KILL_TIMEOUT_MS, KILL_TIMEOUT_MS);
}
@@ -253,11 +253,9 @@ static void children_kill_cb(uv_timer_t *handle)
if (elapsed >= KILL_TIMEOUT_MS) {
int sig = proc->type == kProcessTypePty && elapsed < KILL_TIMEOUT_MS * 2
- ? SIGTERM
- : SIGKILL;
- ILOG("Sending %s to pid %d", sig == SIGTERM ? "SIGTERM" : "SIGKILL",
- proc->pid);
- uv_kill(proc->pid, sig);
+ ? SIGTERM
+ : SIGKILL;
+ os_proc_tree_kill(proc->pid, sig);
}
}
}