Slog2InfoRunner: Connect to QtcProcess::done() signal

Instead of connecting to errorOccurred() and finished() signals.

Add some missing basic error handling.

Change-Id: I5faee9901b5820cd972cf5f6e47880addfbf1d1e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-14 12:43:29 +02:00
parent fb12dd5a55
commit 703525f74b
2 changed files with 11 additions and 5 deletions

View File

@@ -52,15 +52,15 @@ Slog2InfoRunner::Slog2InfoRunner(RunControl *runControl)
m_applicationId.truncate(63);
m_testProcess = new QnxDeviceProcess(device(), this);
connect(m_testProcess, &QtcProcess::finished, this, &Slog2InfoRunner::handleTestProcessCompleted);
connect(m_testProcess, &QtcProcess::done, this, &Slog2InfoRunner::handleTestProcessCompleted);
m_launchDateTimeProcess = new SshDeviceProcess(device(), this);
connect(m_launchDateTimeProcess, &QtcProcess::finished, this, &Slog2InfoRunner::launchSlog2Info);
connect(m_launchDateTimeProcess, &QtcProcess::done, this, &Slog2InfoRunner::launchSlog2Info);
m_logProcess = new QnxDeviceProcess(device(), this);
connect(m_logProcess, &QtcProcess::readyReadStandardOutput, this, &Slog2InfoRunner::readLogStandardOutput);
connect(m_logProcess, &QtcProcess::readyReadStandardError, this, &Slog2InfoRunner::readLogStandardError);
connect(m_logProcess, &QtcProcess::errorOccurred, this, &Slog2InfoRunner::handleLogError);
connect(m_logProcess, &QtcProcess::done, this, &Slog2InfoRunner::handleLogDone);
}
void Slog2InfoRunner::printMissingWarning()
@@ -119,6 +119,9 @@ void Slog2InfoRunner::launchSlog2Info()
if (m_logProcess->state() == QProcess::Running)
return;
if (m_launchDateTimeProcess->error() != QProcess::UnknownError)
return;
m_launchDateTime = QDateTime::fromString(QString::fromLatin1(m_launchDateTimeProcess->readAllStandardOutput()).trimmed(),
QString::fromLatin1("dd HH:mm:ss"));
@@ -190,8 +193,11 @@ void Slog2InfoRunner::readLogStandardError()
appendMessage(QString::fromLatin1(m_logProcess->readAllStandardError()), Utils::StdErrFormat);
}
void Slog2InfoRunner::handleLogError()
void Slog2InfoRunner::handleLogDone()
{
if (m_logProcess->error() == QProcess::UnknownError)
return;
appendMessage(tr("Cannot show slog2info output. Error: %1")
.arg(m_logProcess->errorString()), Utils::StdErrFormat);
}

View File

@@ -56,7 +56,7 @@ private:
void readLogStandardOutput();
void readLogStandardError();
void handleLogError();
void handleLogDone();
void printMissingWarning();
void readLaunchTime();