aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/pty_process_win.h
diff options
context:
space:
mode:
authorRyan Prichard <ryan.prichard@gmail.com>2016-02-24 02:14:19 -0600
committerJustin M. Keyes <justinkz@gmail.com>2017-08-16 09:13:43 +0200
commit7f22a27a10655dc40528f35034cbdf8c9543241c (patch)
treea42277c939dbb715cf1d6505e7abc44f30833612 /src/nvim/os/pty_process_win.h
parent30cb66e8ba520d4564189ff763b5859e3d80581f (diff)
downloadrneovim-7f22a27a10655dc40528f35034cbdf8c9543241c.tar.gz
rneovim-7f22a27a10655dc40528f35034cbdf8c9543241c.tar.bz2
rneovim-7f22a27a10655dc40528f35034cbdf8c9543241c.zip
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<ENTER>" 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.
Diffstat (limited to 'src/nvim/os/pty_process_win.h')
-rw-r--r--src/nvim/os/pty_process_win.h25
1 files changed, 18 insertions, 7 deletions
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 <uv.h>
+
+#include <winpty.h>
+
#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