mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Change to replace stderr with conout
This commit is contained in:
parent
4e06594c53
commit
c86d5fa981
@ -482,7 +482,7 @@ uint64_t channel_from_stdio(bool rpc, CallbackReader on_output,
|
||||
stdin_dup_fd = os_dup(STDIN_FILENO);
|
||||
os_replace_stdin_to_conin();
|
||||
stdout_dup_fd = os_dup(STDOUT_FILENO);
|
||||
os_replace_stdout_to_conout();
|
||||
os_replace_stdout_and_stderr_to_conout();
|
||||
}
|
||||
#endif
|
||||
rstream_init_fd(&main_loop, &channel->stream.stdio.in, stdin_dup_fd, 0);
|
||||
|
@ -24,9 +24,8 @@ void os_replace_stdin_to_conin(void)
|
||||
assert(conin_fd == STDIN_FILENO);
|
||||
}
|
||||
|
||||
void os_replace_stdout_to_conout(void)
|
||||
void os_replace_stdout_and_stderr_to_conout(void)
|
||||
{
|
||||
close(STDOUT_FILENO);
|
||||
const HANDLE conout_handle =
|
||||
CreateFile("CONOUT$",
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
@ -34,6 +33,10 @@ void os_replace_stdout_to_conout(void)
|
||||
(LPSECURITY_ATTRIBUTES)NULL,
|
||||
OPEN_EXISTING, 0, (HANDLE)NULL);
|
||||
assert(conout_handle != INVALID_HANDLE_VALUE);
|
||||
close(STDOUT_FILENO);
|
||||
const int conout_fd = _open_osfhandle((intptr_t)conout_handle, 0);
|
||||
assert(conout_fd == STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
const int conerr_fd = _open_osfhandle((intptr_t)conout_handle, 0);
|
||||
assert(conerr_fd == STDERR_FILENO);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user