QtcProcess: Be idle when incoming data is empty

Don't forward and flush empty data

Change-Id: Idb153695d7eb62905c000b70efdfb0c68f0df9ad
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-06-23 11:22:30 +02:00
parent 44aea533f8
commit 9fde8511e2

View File

@@ -1983,23 +1983,26 @@ void QtcProcessPrivate::handleReadyRead(const QByteArray &outputData, const QByt
m_hangTimerCount = 0;
// TODO: store a copy of m_processChannelMode on start()? Currently we assert that state
// is NotRunning when setting the process channel mode.
if (!outputData.isEmpty()) {
if (m_process->m_setup.m_processChannelMode == QProcess::ForwardedOutputChannel
|| m_process->m_setup.m_processChannelMode == QProcess::ForwardedChannels) {
std::cout << outputData.constData() << std::flush;
} else {
m_stdOut.append(outputData);
if (!outputData.isEmpty())
emitReadyReadStandardOutput();
}
}
if (!errorData.isEmpty()) {
if (m_process->m_setup.m_processChannelMode == QProcess::ForwardedErrorChannel
|| m_process->m_setup.m_processChannelMode == QProcess::ForwardedChannels) {
std::cerr << errorData.constData() << std::flush;
} else {
m_stdErr.append(errorData);
if (!errorData.isEmpty())
emitReadyReadStandardError();
}
}
}
void QtcProcessPrivate::handleDone(const ProcessResultData &data)
{