forked from qt-creator/qt-creator
ClangToolRunner: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals. Change-Id: Ie15a25000a647d4046b59e9ebeb44c32bc29b53b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -85,8 +85,7 @@ void ClangToolRunner::init(const FilePath &outputDirPath, const Environment &env
|
||||
|
||||
m_process->setEnvironment(environment);
|
||||
m_process->setWorkingDirectory(m_outputDirPath); // Current clang-cl puts log file into working dir.
|
||||
connect(m_process, &QtcProcess::finished, this, &ClangToolRunner::onProcessFinished);
|
||||
connect(m_process, &QtcProcess::errorOccurred, this, &ClangToolRunner::onProcessError);
|
||||
connect(m_process, &QtcProcess::done, this, &ClangToolRunner::onProcessDone);
|
||||
}
|
||||
|
||||
QStringList ClangToolRunner::mainToolArguments() const
|
||||
@@ -145,9 +144,11 @@ bool ClangToolRunner::run(const QString &fileToAnalyze, const QStringList &compi
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClangToolRunner::onProcessFinished()
|
||||
void ClangToolRunner::onProcessDone()
|
||||
{
|
||||
if (m_process->result() == ProcessResult::FinishedWithSuccess) {
|
||||
if (m_process->result() == ProcessResult::StartFailed) {
|
||||
emit finishedWithFailure(generalProcessError(m_name), commandlineAndOutput());
|
||||
} else if (m_process->result() == ProcessResult::FinishedWithSuccess) {
|
||||
qCDebug(LOG).noquote() << "Output:\n" << m_process->stdOut();
|
||||
emit finishedWithSuccess(m_fileToAnalyze);
|
||||
} else if (m_process->result() == ProcessResult::FinishedWithError) {
|
||||
@@ -158,14 +159,6 @@ void ClangToolRunner::onProcessFinished()
|
||||
}
|
||||
}
|
||||
|
||||
void ClangToolRunner::onProcessError(QProcess::ProcessError error)
|
||||
{
|
||||
if (error == QProcess::Crashed)
|
||||
return; // handled by slot of finished()
|
||||
|
||||
emit finishedWithFailure(generalProcessError(m_name), commandlineAndOutput());
|
||||
}
|
||||
|
||||
QString ClangToolRunner::commandlineAndOutput() const
|
||||
{
|
||||
return tr("Command line: %1\n"
|
||||
|
@@ -77,8 +77,7 @@ protected:
|
||||
|
||||
private:
|
||||
void onProcessOutput();
|
||||
void onProcessFinished();
|
||||
void onProcessError(QProcess::ProcessError error);
|
||||
void onProcessDone();
|
||||
|
||||
QString commandlineAndOutput() const;
|
||||
|
||||
|
Reference in New Issue
Block a user