Skip to content

Commit

Permalink
in RedirectStdOutput/RedirectStdError/RedirectStdLog only flush when …
Browse files Browse the repository at this point in the history
…last character is newline to avoid garbled output in log file
  • Loading branch information
wwmayer committed Oct 20, 2019
1 parent 867f22d commit 3613d83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Base/Console.cpp
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit 3613d83

Please sign in to comment.