aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ui_client.c')
-rw-r--r--src/nvim/ui_client.c9
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;