forked from qt-creator/qt-creator
Utils: Work around readAllStandardError() with QProcess::MergedChannels
Instead of relying QProcess to operate with MergedChannels, keep the separate channels and merge inside QtcProcess. Fixes: QTCREATORBUG-27196 Change-Id: I3039267fcd6d90f95f8212642e17049b87af1156 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -222,21 +222,28 @@ void CallerHandle::handleStarted(const StartedSignal *launcherSignal)
|
||||
void CallerHandle::handleReadyRead(const ReadyReadSignal *launcherSignal)
|
||||
{
|
||||
QTC_ASSERT(isCalledFromCallersThread(), return);
|
||||
if (m_setup->m_processChannelMode == QProcess::ForwardedOutputChannel
|
||||
|| m_setup->m_processChannelMode == QProcess::ForwardedChannels) {
|
||||
std::cout << launcherSignal->stdOut().constData() << std::flush;
|
||||
} else {
|
||||
if (m_setup->m_processChannelMode == QProcess::MergedChannels) {
|
||||
m_stdout += launcherSignal->stdOut();
|
||||
m_stdout += launcherSignal->stdErr();
|
||||
if (!m_stdout.isEmpty())
|
||||
emit readyReadStandardOutput();
|
||||
}
|
||||
if (m_setup->m_processChannelMode == QProcess::ForwardedErrorChannel
|
||||
|| m_setup->m_processChannelMode == QProcess::ForwardedChannels) {
|
||||
std::cerr << launcherSignal->stdErr().constData() << std::flush;
|
||||
} else {
|
||||
m_stderr += launcherSignal->stdErr();
|
||||
if (!m_stderr.isEmpty())
|
||||
emit readyReadStandardError();
|
||||
if (m_setup->m_processChannelMode == QProcess::ForwardedOutputChannel
|
||||
|| m_setup->m_processChannelMode == QProcess::ForwardedChannels) {
|
||||
std::cout << launcherSignal->stdOut().constData() << std::flush;
|
||||
} else {
|
||||
m_stdout += launcherSignal->stdOut();
|
||||
if (!m_stdout.isEmpty())
|
||||
emit readyReadStandardOutput();
|
||||
}
|
||||
if (m_setup->m_processChannelMode == QProcess::ForwardedErrorChannel
|
||||
|| m_setup->m_processChannelMode == QProcess::ForwardedChannels) {
|
||||
std::cerr << launcherSignal->stdErr().constData() << std::flush;
|
||||
} else {
|
||||
m_stderr += launcherSignal->stdErr();
|
||||
if (!m_stderr.isEmpty())
|
||||
emit readyReadStandardError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user