[Base] Undo last commit because it breaks file redirection.
This reverts commit ceece673e8
.
This commit is contained in:
parent
ceece673e8
commit
cd39bbed5c
|
@ -44,12 +44,16 @@ void AttachConsole() {
|
||||||
}
|
}
|
||||||
has_console_attached_ = true;
|
has_console_attached_ = true;
|
||||||
|
|
||||||
FILE* dummy;
|
auto std_handle = (intptr_t)GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
freopen_s(&dummy, "CONIN$", "rb", stdin);
|
auto con_handle = _open_osfhandle(std_handle, _O_TEXT);
|
||||||
freopen_s(&dummy, "CONOUT$", "wb", stdout);
|
auto fp = _fdopen(con_handle, "w");
|
||||||
freopen_s(&dummy, "CONOUT$", "wb", stderr);
|
*stdout = *fp;
|
||||||
|
|
||||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
|
|
||||||
|
std_handle = (intptr_t)GetStdHandle(STD_ERROR_HANDLE);
|
||||||
|
con_handle = _open_osfhandle(std_handle, _O_TEXT);
|
||||||
|
fp = _fdopen(con_handle, "w");
|
||||||
|
*stderr = *fp;
|
||||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue