diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 2ef5e7e9ca5..ac3ef7796cb 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -647,8 +647,7 @@ void ExternalToolRunner::run() } } m_process = new QtcProcess(this); - connect(m_process, &QtcProcess::finished, this, &ExternalToolRunner::finished); - connect(m_process, &QtcProcess::errorOccurred, this, &ExternalToolRunner::error); + connect(m_process, &QtcProcess::done, this, &ExternalToolRunner::done); connect(m_process, &QtcProcess::readyReadStandardOutput, this, &ExternalToolRunner::readStandardOutput); connect(m_process, &QtcProcess::readyReadStandardError, @@ -667,28 +666,23 @@ void ExternalToolRunner::run() m_process->start(); } -void ExternalToolRunner::finished() +void ExternalToolRunner::done() { if (m_process->result() == ProcessResult::FinishedWithSuccess - && (m_tool->outputHandling() == ExternalTool::ReplaceSelection - || m_tool->errorHandling() == ExternalTool::ReplaceSelection)) { + && (m_tool->outputHandling() == ExternalTool::ReplaceSelection + || m_tool->errorHandling() == ExternalTool::ReplaceSelection)) { ExternalToolManager::emitReplaceSelectionRequested(m_processOutput); } + const QString message = (m_process->result() == ProcessResult::FinishedWithSuccess) + ? tr("\"%1\" finished").arg(m_resolvedExecutable.toUserOutput()) + : tr("\"%1\" finished with error").arg(m_resolvedExecutable.toUserOutput()); + if (m_tool->modifiesCurrentDocument()) DocumentManager::unexpectFileChange(m_expectedFilePath); const auto write = m_tool->outputHandling() == ExternalTool::ShowInPane ? QOverload::of(MessageManager::writeFlashing) : QOverload::of(MessageManager::writeSilently); - write(tr("\"%1\" finished").arg(m_resolvedExecutable.toUserOutput())); - deleteLater(); -} - -void ExternalToolRunner::error(QProcess::ProcessError error) -{ - if (m_tool->modifiesCurrentDocument()) - DocumentManager::unexpectFileChange(m_expectedFilePath); - // TODO inform about errors - Q_UNUSED(error) + write(message); deleteLater(); } diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index caec43258c1..a1e16f10f56 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -135,8 +135,7 @@ public: QString errorString() const; private: - void finished(); - void error(QProcess::ProcessError error); + void done(); void readStandardOutput(); void readStandardError();