Utils: Move SynchronousProcess::normalizeNewlines to QtcProcess

Change-Id: I5ba8ba1061b04b032aafd08382d34ccb62272829
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-04-30 17:21:43 +02:00
parent 196b7b0f24
commit dec9169efe
8 changed files with 23 additions and 24 deletions

View File

@@ -1627,6 +1627,17 @@ bool QtcProcess::ArgIterator::next()
}
}
QString QtcProcess::normalizeNewlines(const QString &text)
{
QString res = text;
const auto newEnd = std::unique(res.begin(), res.end(), [](const QChar &c1, const QChar &c2) {
return c1 == '\r' && c2 == '\r'; // QTCREATORBUG-24556
});
res.chop(std::distance(newEnd, res.end()));
res.replace("\r\n", "\n");
return res;
}
void QtcProcess::ArgIterator::deleteArg()
{
if (!m_prev)