changeset 22570:8af8aa57dd8a v8.2.1833

patch 8.2.1833: when reading from stdin dup() is called twice Commit: https://github.com/vim/vim/commit/204ade6bcb85f48f56e52e040d1ebf40548d92be Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 11 14:58:46 2020 +0200 patch 8.2.1833: when reading from stdin dup() is called twice Problem: When reading from stdin dup() is called twice. Solution: Remove the dup() in main.c. (Ken Takata, closes https://github.com/vim/vim/issues/7110)
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Oct 2020 15:00:03 +0200
parents 14b0cc97f92b
children 7fb99507041c
files src/main.c src/version.c
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -2704,21 +2704,16 @@ read_stdin(void)
     no_wait_return = TRUE;
     i = msg_didany;
     set_buflisted(TRUE);
-    (void)open_buffer(TRUE, NULL, 0);	// create memfile and read file
+
+    // Create memfile and read from stdin.
+    // This will also dup stdin from stderr to read commands from.
+    (void)open_buffer(TRUE, NULL, 0);
+
     no_wait_return = FALSE;
     msg_didany = i;
     TIME_MSG("reading stdin");
 
     check_swap_exists_action();
-#if !(defined(AMIGA) || defined(MACOS_X))
-    /*
-     * Close stdin and dup it from stderr.  Required for GPM to work
-     * properly, and for running external commands.
-     * Is there any other system that cannot do this?
-     */
-    close(0);
-    vim_ignored = dup(2);
-#endif
 }
 
 /*
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1833,
+/**/
     1832,
 /**/
     1831,