forked from qt-creator/qt-creator
Utils: Minor cleanup in SynchronousProcess
* Do not reserve QString before replacing it with another * Do not append \n when there's only stdout Change-Id: If75eade473949437a4b5fea2ac0153fa2853b3c8 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
7a40d31598
commit
fae08f5c7c
@@ -141,9 +141,7 @@ QString SynchronousProcessResponse::exitMessage(const QString &binary, int timeo
|
||||
QByteArray SynchronousProcessResponse::allRawOutput() const
|
||||
{
|
||||
if (!rawStdOut.isEmpty() && !rawStdErr.isEmpty()) {
|
||||
QByteArray result;
|
||||
result.reserve(rawStdOut.size() + rawStdErr.size() + 1);
|
||||
result = rawStdOut;
|
||||
QByteArray result = rawStdOut;
|
||||
if (!result.endsWith('\n'))
|
||||
result += '\n';
|
||||
result += rawStdErr;
|
||||
@@ -157,13 +155,14 @@ QString SynchronousProcessResponse::allOutput() const
|
||||
const QString out = stdOut();
|
||||
const QString err = stdErr();
|
||||
|
||||
QString result;
|
||||
result.reserve(out.size() + err.size() + 1);
|
||||
result = out;
|
||||
if (!result.endsWith('\n'))
|
||||
result += '\n';
|
||||
result += err;
|
||||
return result;
|
||||
if (!out.isEmpty() && !err.isEmpty()) {
|
||||
QString result = out;
|
||||
if (!result.endsWith('\n'))
|
||||
result += '\n';
|
||||
result += err;
|
||||
return result;
|
||||
}
|
||||
return !out.isEmpty() ? out : err;
|
||||
}
|
||||
|
||||
QString SynchronousProcessResponse::stdOut() const
|
||||
|
||||
Reference in New Issue
Block a user