From 4a6b80dbb6709079877837741b3285b48da7b2b2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 20 Oct 2019 13:42:51 +0200 Subject: [PATCH] in RedirectStdOutput/RedirectStdError/RedirectStdLog only flush when last character is newline to avoid garbled output in log file --- src/Base/Console.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Base/Console.cpp b/src/Base/Console.cpp index 9753808962..348666457e 100644 --- a/src/Base/Console.cpp +++ b/src/Base/Console.cpp @@ -893,7 +893,7 @@ int RedirectStdOutput::overflow(int c) int RedirectStdOutput::sync() { // Print as log as this might be verbose - if (!buffer.empty()) { + if (!buffer.empty() && buffer.back() == '\n') { Base::Console().Log("%s", buffer.c_str()); buffer.clear(); } @@ -915,7 +915,7 @@ int RedirectStdLog::overflow(int c) int RedirectStdLog::sync() { // Print as log as this might be verbose - if (!buffer.empty()) { + if (!buffer.empty() && buffer.back() == '\n') { Base::Console().Log("%s", buffer.c_str()); buffer.clear(); } @@ -936,7 +936,7 @@ int RedirectStdError::overflow(int c) int RedirectStdError::sync() { - if (!buffer.empty()) { + if (!buffer.empty() && buffer.back() == '\n') { Base::Console().Error("%s", buffer.c_str()); buffer.clear(); }