diff options
author | hlpr98 <hlpr98@gmail.com> | 2019-05-27 22:04:24 +0530 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-12-31 10:43:28 +0100 |
commit | 24488169564c39a506c235bf6a33b8e23a8cb528 (patch) | |
tree | 3b30c1fcc3b4ce2fef81d45eebe61baa4f0315ed /src/nvim/event | |
parent | 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf (diff) | |
download | rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.tar.gz rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.tar.bz2 rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.zip |
feat(tui): run TUI as external process
Diffstat (limited to 'src/nvim/event')
-rw-r--r-- | src/nvim/event/libuv_process.c | 8 | ||||
-rw-r--r-- | src/nvim/event/libuv_process.h | 2 | ||||
-rw-r--r-- | src/nvim/event/process.c | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index c5d3b94c95..cf4ff16c4d 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -40,11 +40,19 @@ int libuv_process_spawn(LibuvProcess *uvproc) #endif uvproc->uvopts.exit_cb = exit_cb; uvproc->uvopts.cwd = proc->cwd; + uvproc->uvopts.stdio = uvproc->uvstdio; uvproc->uvopts.stdio_count = 3; uvproc->uvstdio[0].flags = UV_IGNORE; uvproc->uvstdio[1].flags = UV_IGNORE; uvproc->uvstdio[2].flags = UV_IGNORE; + + // TODO: this should just be single flag! + if (TUI_process && !is_remote_client && !stdin_isatty) { + uvproc->uvopts.stdio_count = 4; + uvproc->uvstdio[3].data.fd = 0; + uvproc->uvstdio[3].flags = UV_INHERIT_FD; + } uvproc->uv.data = proc; if (proc->env) { diff --git a/src/nvim/event/libuv_process.h b/src/nvim/event/libuv_process.h index 8f987847d8..4472839944 100644 --- a/src/nvim/event/libuv_process.h +++ b/src/nvim/event/libuv_process.h @@ -10,7 +10,7 @@ typedef struct libuv_process { Process process; uv_process_t uv; uv_process_options_t uvopts; - uv_stdio_container_t uvstdio[3]; + uv_stdio_container_t uvstdio[4]; } LibuvProcess; static inline LibuvProcess libuv_process_init(Loop *loop, void *data) diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index e74e95669d..52a9394e88 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -404,6 +404,10 @@ static void on_process_exit(Process *proc) ILOG("exited: pid=%d status=%d stoptime=%" PRIu64, proc->pid, proc->status, proc->stopped_time); + if (TUI_process && !is_remote_client) { + // Set only in "builtin" TUI + server_process_exit_status = proc->status; + } // Process has terminated, but there could still be data to be read from the // OS. We are still in the libuv loop, so we cannot call code that polls for // more data directly. Instead delay the reading after the libuv loop by |