forked from qt-creator/qt-creator
OutputParser: Allow to flush pending tasks.
Add a way to flush out tasks from the outputparsers. This is necessary to make parsers that keep state more robust. Flush parsers (once) before adding any new task. This keeps the sequence intact. Flush all parsers once the parsing is done to make sure there is no task queued somewhere. Task-number: QTCREATORBUG-9195 Change-Id: Icd37df1f470cb73123ad286d6900ad1047a1d512 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -88,7 +88,7 @@ using namespace ProjectExplorer;
|
||||
AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, const Core::Id id) :
|
||||
BuildStep(bsl, id), m_timer(0), m_futureInterface(0),
|
||||
m_ignoreReturnValue(false), m_process(0),
|
||||
m_outputParserChain(0)
|
||||
m_outputParserChain(0), m_skipFlush(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl,
|
||||
AbstractProcessStep *bs) :
|
||||
BuildStep(bsl, bs), m_timer(0), m_futureInterface(0),
|
||||
m_ignoreReturnValue(bs->m_ignoreReturnValue),
|
||||
m_process(0), m_outputParserChain(0)
|
||||
m_process(0), m_outputParserChain(0), m_skipFlush(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -261,6 +261,9 @@ void AbstractProcessStep::processStarted()
|
||||
|
||||
void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
{
|
||||
if (m_outputParserChain)
|
||||
m_outputParserChain->flush();
|
||||
|
||||
QString command = QDir::toNativeSeparators(m_param.effectiveCommand());
|
||||
if (status == QProcess::NormalExit && exitCode == 0) {
|
||||
emit addOutput(tr("The process \"%1\" exited normally.").arg(command),
|
||||
@@ -367,6 +370,13 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::Task &task)
|
||||
if (m_ignoreReturnValue)
|
||||
return;
|
||||
|
||||
// flush out any pending tasks before proceeding:
|
||||
if (!m_skipFlush && m_outputParserChain) {
|
||||
m_skipFlush = true;
|
||||
m_outputParserChain->flush();
|
||||
m_skipFlush = false;
|
||||
}
|
||||
|
||||
Task editable(task);
|
||||
QString filePath = task.file.toString();
|
||||
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
|
||||
|
||||
Reference in New Issue
Block a user