forked from qt-creator/qt-creator
RunControl: Add more helper functions to SimpleTargetRunner
Allow to disable the forwarding of stdout and stderr and provide access to the underlying Process. This can be used when stdout and stderr need to be forwarded to other RunWorkers. Change-Id: I7fb789defe8a57831fcaf312fc7b500affdf2f61 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1264,6 +1264,7 @@ public:
|
|||||||
|
|
||||||
bool m_stopReported = false;
|
bool m_stopReported = false;
|
||||||
bool m_stopForced = false;
|
bool m_stopForced = false;
|
||||||
|
bool m_suppressDefaultStdOutHandling = false;
|
||||||
|
|
||||||
void forwardStarted();
|
void forwardStarted();
|
||||||
void forwardDone();
|
void forwardDone();
|
||||||
@@ -1372,6 +1373,9 @@ void SimpleTargetRunnerPrivate::handleDone()
|
|||||||
|
|
||||||
void SimpleTargetRunnerPrivate::handleStandardOutput()
|
void SimpleTargetRunnerPrivate::handleStandardOutput()
|
||||||
{
|
{
|
||||||
|
if (m_suppressDefaultStdOutHandling)
|
||||||
|
return;
|
||||||
|
|
||||||
const QByteArray data = m_process.readAllRawStandardOutput();
|
const QByteArray data = m_process.readAllRawStandardOutput();
|
||||||
const QString msg = m_outputCodec->toUnicode(
|
const QString msg = m_outputCodec->toUnicode(
|
||||||
data.constData(), data.length(), &m_outputCodecState);
|
data.constData(), data.length(), &m_outputCodecState);
|
||||||
@@ -1380,6 +1384,9 @@ void SimpleTargetRunnerPrivate::handleStandardOutput()
|
|||||||
|
|
||||||
void SimpleTargetRunnerPrivate::handleStandardError()
|
void SimpleTargetRunnerPrivate::handleStandardError()
|
||||||
{
|
{
|
||||||
|
if (m_suppressDefaultStdOutHandling)
|
||||||
|
return;
|
||||||
|
|
||||||
const QByteArray data = m_process.readAllRawStandardError();
|
const QByteArray data = m_process.readAllRawStandardError();
|
||||||
const QString msg = m_outputCodec->toUnicode(
|
const QString msg = m_outputCodec->toUnicode(
|
||||||
data.constData(), data.length(), &m_errorCodecState);
|
data.constData(), data.length(), &m_errorCodecState);
|
||||||
@@ -1571,6 +1578,16 @@ void SimpleTargetRunner::setProcessMode(Utils::ProcessMode processMode)
|
|||||||
d->m_process.setProcessMode(processMode);
|
d->m_process.setProcessMode(processMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process *SimpleTargetRunner::process() const
|
||||||
|
{
|
||||||
|
return &d->m_process;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleTargetRunner::suppressDefaultStdOutHandling()
|
||||||
|
{
|
||||||
|
d->m_suppressDefaultStdOutHandling = true;
|
||||||
|
}
|
||||||
|
|
||||||
void SimpleTargetRunner::forceRunOnHost()
|
void SimpleTargetRunner::forceRunOnHost()
|
||||||
{
|
{
|
||||||
const FilePath executable = d->m_command.executable();
|
const FilePath executable = d->m_command.executable();
|
||||||
|
@@ -27,6 +27,7 @@ class Icon;
|
|||||||
class MacroExpander;
|
class MacroExpander;
|
||||||
class OutputLineParser;
|
class OutputLineParser;
|
||||||
class ProcessRunData;
|
class ProcessRunData;
|
||||||
|
class Process;
|
||||||
} // Utils
|
} // Utils
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -271,7 +272,9 @@ protected:
|
|||||||
void setEnvironment(const Utils::Environment &environment);
|
void setEnvironment(const Utils::Environment &environment);
|
||||||
void setWorkingDirectory(const Utils::FilePath &workingDirectory);
|
void setWorkingDirectory(const Utils::FilePath &workingDirectory);
|
||||||
void setProcessMode(Utils::ProcessMode processMode);
|
void setProcessMode(Utils::ProcessMode processMode);
|
||||||
|
Utils::Process *process() const;
|
||||||
|
|
||||||
|
void suppressDefaultStdOutHandling();
|
||||||
void forceRunOnHost();
|
void forceRunOnHost();
|
||||||
void addExtraData(const QString &key, const QVariant &value);
|
void addExtraData(const QString &key, const QVariant &value);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user