aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/StartProcess.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/common/Utilities/StartProcess.cpp b/src/common/Utilities/StartProcess.cpp
index 0665e2644bf..00e5bc0bfe7 100644
--- a/src/common/Utilities/StartProcess.cpp
+++ b/src/common/Utilities/StartProcess.cpp
@@ -19,7 +19,6 @@
#include "Errors.h"
#include "Log.h"
#include "Optional.h"
-#include "Util.h"
#include "Hacks/boost_1_73_process_windows_nopch.h"
@@ -54,10 +53,19 @@ public:
std::streamsize write(char const* str, std::streamsize size)
{
- std::string consoleStr(str, size);
- RemoveCRLF(consoleStr);
- callback_(consoleStr);
- return size;
+ std::string_view consoleStr(str, size);
+ size_t lineEnd = consoleStr.find_first_of("\r\n");
+ std::streamsize processedCharacters = size;
+ if (lineEnd != std::string_view::npos)
+ {
+ consoleStr = consoleStr.substr(0, lineEnd);
+ processedCharacters = lineEnd + 1;
+ }
+
+ if (!consoleStr.empty())
+ callback_(consoleStr);
+
+ return processedCharacters;
}
};
@@ -119,14 +127,14 @@ static int CreateChildProcess(T waiter, std::string const& executable,
}
}();
- auto outInfo = MakeTCLogSink([&](std::string const& msg)
+ auto outInfo = MakeTCLogSink([&](std::string_view msg)
{
- TC_LOG_INFO(logger, "%s", msg.c_str());
+ TC_LOG_INFO(logger, STRING_VIEW_FMT, STRING_VIEW_FMT_ARG(msg));
});
- auto outError = MakeTCLogSink([&](std::string const& msg)
+ auto outError = MakeTCLogSink([&](std::string_view msg)
{
- TC_LOG_ERROR(logger, "%s", msg.c_str());
+ TC_LOG_ERROR(logger, STRING_VIEW_FMT, STRING_VIEW_FMT_ARG(msg));
});
copy(outStream, outInfo);