mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
Add stdin, stdout replacement functions
This commit is contained in:
@@ -64,6 +64,9 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/os/fileio.h"
|
||||
#ifdef WIN32
|
||||
# include "nvim/os/os_win_console.h"
|
||||
#endif
|
||||
#include "nvim/event/loop.h"
|
||||
#include "nvim/os/signal.h"
|
||||
#include "nvim/event/process.h"
|
||||
@@ -1120,13 +1123,7 @@ scripterror:
|
||||
const int stdin_dup_fd = os_dup(STDIN_FILENO);
|
||||
#ifdef WIN32
|
||||
// Replace the original stdin with the console input handle.
|
||||
close(STDIN_FILENO);
|
||||
const HANDLE conin_handle =
|
||||
CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)NULL,
|
||||
OPEN_EXISTING, 0, (HANDLE)NULL);
|
||||
const int conin_fd = _open_osfhandle(conin_handle, _O_RDONLY);
|
||||
assert(conin_fd == STDIN_FILENO);
|
||||
os_replace_stdin_to_conin();
|
||||
#endif
|
||||
FileDescriptor *const stdin_dup = file_open_fd_new(
|
||||
&error, stdin_dup_fd, kFileReadOnly|kFileNonBlocking);
|
||||
|
Reference in New Issue
Block a user