From 5afff7821f879de487f80a8e918fe36afbcb0318 Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 5 Feb 2022 14:23:33 +0200 Subject: [PATCH] throw if flush failed --- include/spdlog/details/file_helper-inl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/file_helper-inl.h b/include/spdlog/details/file_helper-inl.h index 8276633b..fa082253 100644 --- a/include/spdlog/details/file_helper-inl.h +++ b/include/spdlog/details/file_helper-inl.h @@ -84,7 +84,10 @@ SPDLOG_INLINE void file_helper::reopen(bool truncate) SPDLOG_INLINE void file_helper::flush() { - std::fflush(fd_); + if(std::fflush(fd_) != 0) + { + throw_spdlog_ex("Failed flush to file " + os::filename_to_str(filename_), errno); + } } SPDLOG_INLINE void file_helper::close()