in RedirectStdOutput/RedirectStdError/RedirectStdLog only flush when last character is newline to avoid garbled output in log file

This commit is contained in:
wmayer
2019-10-20 13:42:51 +02:00
parent c642768756
commit 4a6b80dbb6

View File

@@ -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();
}