diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:31:31 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:31:31 +0000 |
commit | 9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch) | |
tree | 607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /src/nvim/channel.c | |
parent | 9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff) | |
parent | 3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff) | |
download | rneovim-usermarks.tar.gz rneovim-usermarks.tar.bz2 rneovim-usermarks.zip |
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'src/nvim/channel.c')
-rw-r--r-- | src/nvim/channel.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/nvim/channel.c b/src/nvim/channel.c index 5910053025..65bb87bc2c 100644 --- a/src/nvim/channel.c +++ b/src/nvim/channel.c @@ -1,24 +1,42 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +#include <assert.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> + +#include "lauxlib.h" #include "nvim/api/private/converter.h" +#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -#include "nvim/api/ui.h" #include "nvim/autocmd.h" +#include "nvim/buffer_defs.h" #include "nvim/channel.h" #include "nvim/eval.h" #include "nvim/eval/encode.h" +#include "nvim/eval/typval.h" +#include "nvim/event/loop.h" +#include "nvim/event/rstream.h" #include "nvim/event/socket.h" +#include "nvim/event/wstream.h" +#include "nvim/gettext.h" +#include "nvim/globals.h" +#include "nvim/log.h" #include "nvim/lua/executor.h" +#include "nvim/main.h" +#include "nvim/memory.h" +#include "nvim/message.h" #include "nvim/msgpack_rpc/channel.h" #include "nvim/msgpack_rpc/server.h" -#include "nvim/os/fs.h" +#include "nvim/os/os_defs.h" #include "nvim/os/shell.h" -#ifdef WIN32 +#include "nvim/rbuffer.h" +#ifdef MSWIN # include "nvim/os/os_win_console.h" # include "nvim/os/pty_conpty_win.h" #endif -#include "nvim/ascii.h" #include "nvim/path.h" static bool did_stdio = false; @@ -197,7 +215,7 @@ void channel_create_event(Channel *chan, const char *ext_source) // external events should be included. source = ext_source; } else { - eval_fmt_source_name_line((char *)IObuff, sizeof(IObuff)); + eval_fmt_source_name_line(IObuff, sizeof(IObuff)); source = (const char *)IObuff; } @@ -359,6 +377,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader } else { has_out = rpc || callback_reader_set(chan->on_data); has_err = callback_reader_set(chan->on_stderr); + proc->fwd_err = chan->on_stderr.fwd_err; } switch (stdin_mode) { @@ -492,7 +511,7 @@ uint64_t channel_from_stdio(bool rpc, CallbackReader on_output, const char **err int stdin_dup_fd = STDIN_FILENO; int stdout_dup_fd = STDOUT_FILENO; -#ifdef WIN32 +#ifdef MSWIN // Strangely, ConPTY doesn't work if stdin and stdout are pipes. So replace // stdin and stdout with CONIN$ and CONOUT$, respectively. if (embedded_mode && os_has_conpty_working()) { @@ -501,6 +520,13 @@ uint64_t channel_from_stdio(bool rpc, CallbackReader on_output, const char **err stdout_dup_fd = os_dup(STDOUT_FILENO); os_replace_stdout_and_stderr_to_conout(); } +#else + if (embedded_mode) { + stdin_dup_fd = dup(STDIN_FILENO); + stdout_dup_fd = dup(STDOUT_FILENO); + dup2(STDERR_FILENO, STDOUT_FILENO); + dup2(STDERR_FILENO, STDIN_FILENO); + } #endif rstream_init_fd(&main_loop, &channel->stream.stdio.in, stdin_dup_fd, 0); wstream_init_fd(&main_loop, &channel->stream.stdio.out, stdout_dup_fd, 0); |