Mercurial > vim
comparison src/main.c @ 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 | 35921b7fc07a |
children | 3204c5e23474 |
comparison
equal
deleted
inserted
replaced
22569:14b0cc97f92b | 22570:8af8aa57dd8a |
---|---|
2702 swap_exists_action = SEA_DIALOG; | 2702 swap_exists_action = SEA_DIALOG; |
2703 | 2703 |
2704 no_wait_return = TRUE; | 2704 no_wait_return = TRUE; |
2705 i = msg_didany; | 2705 i = msg_didany; |
2706 set_buflisted(TRUE); | 2706 set_buflisted(TRUE); |
2707 (void)open_buffer(TRUE, NULL, 0); // create memfile and read file | 2707 |
2708 // Create memfile and read from stdin. | |
2709 // This will also dup stdin from stderr to read commands from. | |
2710 (void)open_buffer(TRUE, NULL, 0); | |
2711 | |
2708 no_wait_return = FALSE; | 2712 no_wait_return = FALSE; |
2709 msg_didany = i; | 2713 msg_didany = i; |
2710 TIME_MSG("reading stdin"); | 2714 TIME_MSG("reading stdin"); |
2711 | 2715 |
2712 check_swap_exists_action(); | 2716 check_swap_exists_action(); |
2713 #if !(defined(AMIGA) || defined(MACOS_X)) | |
2714 /* | |
2715 * Close stdin and dup it from stderr. Required for GPM to work | |
2716 * properly, and for running external commands. | |
2717 * Is there any other system that cannot do this? | |
2718 */ | |
2719 close(0); | |
2720 vim_ignored = dup(2); | |
2721 #endif | |
2722 } | 2717 } |
2723 | 2718 |
2724 /* | 2719 /* |
2725 * Create the requested number of windows and edit buffers in them. | 2720 * Create the requested number of windows and edit buffers in them. |
2726 * Also does recovery if "recoverymode" set. | 2721 * Also does recovery if "recoverymode" set. |