From 7f22a27a10655dc40528f35034cbdf8c9543241c Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Wed, 24 Feb 2016 02:14:19 -0600 Subject: win: integrate winpty (WIP) Handling of process exit is still broken. It detects the moment when the child process exits, then quickly stops polling for process output. It should continue polling for output until the agent has scraped all of the process' output. This problem is easy to notice by running a command like "dir && exit", but even typing "exit" can manifest the problem -- the "t" might not appear. winpty's Cygwin adapter handles shutdown by waiting for the agent to close the CONOUT pipe, which it does after it has scraped the child's last output. AFAIK, neovim doesn't do anything interesting when winpty closes the CONOUT pipe. --- src/nvim/os/pty_process_win.h | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/nvim/os/pty_process_win.h') diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h index 8e2b37a1c1..87b2b6545d 100644 --- a/src/nvim/os/pty_process_win.h +++ b/src/nvim/os/pty_process_win.h @@ -1,21 +1,23 @@ #ifndef NVIM_OS_PTY_PROCESS_WIN_H #define NVIM_OS_PTY_PROCESS_WIN_H +#include + +#include + #include "nvim/event/libuv_process.h" typedef struct pty_process { Process process; char *term_name; uint16_t width, height; + winpty_t *wp; + uv_async_t finish_async; + HANDLE finish_wait; + HANDLE process_handle; + bool is_closing; } PtyProcess; -#define pty_process_spawn(job) libuv_process_spawn((LibuvProcess *)job) -#define pty_process_close(job) libuv_process_close((LibuvProcess *)job) -#define pty_process_close_master(job) libuv_process_close((LibuvProcess *)job) -#define pty_process_resize(job, width, height) ( \ - (void)job, (void)width, (void)height, 0) -#define pty_process_teardown(loop) ((void)loop, 0) - static inline PtyProcess pty_process_init(Loop *loop, void *data) { PtyProcess rv; @@ -23,7 +25,16 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data) rv.term_name = NULL; rv.width = 80; rv.height = 24; + rv.wp = NULL; + // XXX: Zero rv.finish_async somehow? + rv.finish_wait = NULL; + rv.process_handle = NULL; + rv.is_closing = false; return rv; } +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/pty_process_win.h.generated.h" +#endif + #endif // NVIM_OS_PTY_PROCESS_WIN_H -- cgit From 4b1f21de75f9981007d80aca8355239e8615d6bd Mon Sep 17 00:00:00 2001 From: erw7 Date: Tue, 28 Mar 2017 18:07:58 +0900 Subject: win: support :terminal --- src/nvim/os/pty_process_win.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/nvim/os/pty_process_win.h') diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h index 87b2b6545d..806857f130 100644 --- a/src/nvim/os/pty_process_win.h +++ b/src/nvim/os/pty_process_win.h @@ -5,19 +5,24 @@ #include -#include "nvim/event/libuv_process.h" +#include "nvim/event/process.h" +#include "nvim/lib/queue.h" typedef struct pty_process { Process process; char *term_name; uint16_t width, height; winpty_t *wp; - uv_async_t finish_async; HANDLE finish_wait; HANDLE process_handle; - bool is_closing; + uv_timer_t wait_eof_timer; } PtyProcess; +typedef struct arg_S { + char *arg; + QUEUE node; +} arg_T; + static inline PtyProcess pty_process_init(Loop *loop, void *data) { PtyProcess rv; @@ -26,10 +31,8 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data) rv.width = 80; rv.height = 24; rv.wp = NULL; - // XXX: Zero rv.finish_async somehow? rv.finish_wait = NULL; rv.process_handle = NULL; - rv.is_closing = false; return rv; } -- cgit From 84fb794da653fc3bcc2832816ca0cab01b4e0400 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 2 Apr 2017 18:16:39 +0900 Subject: win/pyt: cleanup --- src/nvim/os/pty_process_win.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/nvim/os/pty_process_win.h') diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h index 806857f130..59e0fad7f7 100644 --- a/src/nvim/os/pty_process_win.h +++ b/src/nvim/os/pty_process_win.h @@ -12,16 +12,17 @@ typedef struct pty_process { Process process; char *term_name; uint16_t width, height; - winpty_t *wp; + winpty_t *winpty_object; HANDLE finish_wait; HANDLE process_handle; uv_timer_t wait_eof_timer; } PtyProcess; -typedef struct arg_S { - char *arg; - QUEUE node; -} arg_T; +// Structure used by build_cmd_line() +typedef struct arg_node { + char *arg; // pointer to argument. + QUEUE node; // QUEUE structure. +} ArgNode; static inline PtyProcess pty_process_init(Loop *loop, void *data) { @@ -30,7 +31,7 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data) rv.term_name = NULL; rv.width = 80; rv.height = 24; - rv.wp = NULL; + rv.winpty_object = NULL; rv.finish_wait = NULL; rv.process_handle = NULL; return rv; -- cgit From d3a8c4f99289f7b65a68bf9ed5eeab34aa688e0e Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 2 Apr 2017 18:32:23 +0900 Subject: win/pty: log errors --- src/nvim/os/pty_process_win.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/os/pty_process_win.h') diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h index 59e0fad7f7..1a4019e654 100644 --- a/src/nvim/os/pty_process_win.h +++ b/src/nvim/os/pty_process_win.h @@ -2,7 +2,6 @@ #define NVIM_OS_PTY_PROCESS_WIN_H #include - #include #include "nvim/event/process.h" -- cgit