Skip to content

Commit

Permalink
add buffer flush before direct write
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman-Koshelev committed Oct 23, 2023
1 parent 8dbae41 commit 4fe961f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,7 @@ extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
FMT_FUNC bool write_console(std::FILE* f, string_view text) {
int fd = _fileno(f);
if (!_isatty(fd)) return false;
std::fflush(f);
auto u16 = utf8_to_utf16(text);
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
Expand Down

0 comments on commit 4fe961f

Please sign in to comment.