diff options
author | erw7 <erw7.github@gmail.com> | 2019-11-22 13:51:14 +0900 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-01-17 11:36:28 +0100 |
commit | c86d5fa981b0651167f789aaff685b42cad7aaca (patch) | |
tree | deac6452b705e7a1308c9ec4ac46c9791cd0e0f6 | |
parent | 4e06594c53645c9b3dc6c57850f712a810d071d3 (diff) | |
download | rneovim-c86d5fa981b0651167f789aaff685b42cad7aaca.tar.gz rneovim-c86d5fa981b0651167f789aaff685b42cad7aaca.tar.bz2 rneovim-c86d5fa981b0651167f789aaff685b42cad7aaca.zip |
Change to replace stderr with conout
-rw-r--r-- | src/nvim/channel.c | 2 | ||||
-rw-r--r-- | src/nvim/os/os_win_console.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/channel.c b/src/nvim/channel.c index d3e2977eae..c66a0682e3 100644 --- a/src/nvim/channel.c +++ b/src/nvim/channel.c @@ -482,7 +482,7 @@ uint64_t channel_from_stdio(bool rpc, CallbackReader on_output, stdin_dup_fd = os_dup(STDIN_FILENO); os_replace_stdin_to_conin(); stdout_dup_fd = os_dup(STDOUT_FILENO); - os_replace_stdout_to_conout(); + os_replace_stdout_and_stderr_to_conout(); } #endif rstream_init_fd(&main_loop, &channel->stream.stdio.in, stdin_dup_fd, 0); diff --git a/src/nvim/os/os_win_console.c b/src/nvim/os/os_win_console.c index 6cabeb2c9a..8a0aa2f5ae 100644 --- a/src/nvim/os/os_win_console.c +++ b/src/nvim/os/os_win_console.c @@ -24,9 +24,8 @@ void os_replace_stdin_to_conin(void) assert(conin_fd == STDIN_FILENO); } -void os_replace_stdout_to_conout(void) +void os_replace_stdout_and_stderr_to_conout(void) { - close(STDOUT_FILENO); const HANDLE conout_handle = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE, @@ -34,6 +33,10 @@ void os_replace_stdout_to_conout(void) (LPSECURITY_ATTRIBUTES)NULL, OPEN_EXISTING, 0, (HANDLE)NULL); assert(conout_handle != INVALID_HANDLE_VALUE); + close(STDOUT_FILENO); const int conout_fd = _open_osfhandle((intptr_t)conout_handle, 0); assert(conout_fd == STDOUT_FILENO); + close(STDERR_FILENO); + const int conerr_fd = _open_osfhandle((intptr_t)conout_handle, 0); + assert(conerr_fd == STDERR_FILENO); } |