diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 72cfb6dd99317..961182f150644 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1435,6 +1435,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(_get_osfhandle(fd)), u16.c_str(), static_cast(u16.size()), nullptr, nullptr) != 0; diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index c3dc8956d61ef..976501653d846 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -52,6 +52,7 @@ inline bool write_ostream_unicode(std::ostream& os, fmt::string_view data) { return false; #endif if (!c_file) return false; + os.flush(); return write_console(c_file, data); }