add buffer flush before direct write
This commit is contained in:
parent
8dbae411f4
commit
4fe961f796
@ -1434,6 +1434,7 @@ extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
|
|||||||
FMT_FUNC bool write_console(std::FILE* f, string_view text) {
|
FMT_FUNC bool write_console(std::FILE* f, string_view text) {
|
||||||
int fd = _fileno(f);
|
int fd = _fileno(f);
|
||||||
if (!_isatty(fd)) return false;
|
if (!_isatty(fd)) return false;
|
||||||
|
std::fflush(f);
|
||||||
auto u16 = utf8_to_utf16(text);
|
auto u16 = utf8_to_utf16(text);
|
||||||
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
|
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
|
||||||
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
|
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user