diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-01-10 14:03:15 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-01-16 11:26:49 +0100 |
commit | 160c69b655ce2e47fbedcc87fcb4949c2bc04dce (patch) | |
tree | cdbce0fdd0318b8103d1d0278d517072f5bd4d4b /src/nvim/ui_client.c | |
parent | 43feb973e30ed40b8eb7bc97b0f41eef0b51194b (diff) | |
download | rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.tar.gz rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.tar.bz2 rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.zip |
fix(ui): re-organize tty fd handling and fix issues
- Use the correct fd to replace stdin on windows (CONIN)
- Don't start the TUI if there are no tty fd (not a regression,
but makes sense regardless)
- De-mythologize "global input fd". it is just STDIN.
Diffstat (limited to 'src/nvim/ui_client.c')
-rw-r--r-- | src/nvim/ui_client.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index ff82fd3239..47c255fc80 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -48,9 +48,16 @@ uint64_t ui_client_start_server(int argc, char **argv) on_err, CALLBACK_NONE, false, true, true, false, kChannelStdinPipe, NULL, 0, 0, NULL, &exit_status); + + // If stdin is not a pty, it is forwarded to the client. + // Replace stdin in the TUI process with the tty fd. if (ui_client_forward_stdin) { close(0); - dup(2); +#ifdef MSWIN + os_open_conin_fd(); +#else + dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO); +#endif } return channel->id; |