RsyncDeployService: Connect to QtcProcess::done() signal

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

Change-Id: If18ff8431efa7f3b45212fe737f66fb4eb6c6fb5
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-06 14:38:41 +02:00
parent 8816759a85
commit e9f1ff9193

View File

@@ -128,24 +128,19 @@ void RsyncDeployService::deployFiles()
connect(&m_rsync, &QtcProcess::readyReadStandardError, this, [this] { connect(&m_rsync, &QtcProcess::readyReadStandardError, this, [this] {
emit warningMessage(QString::fromLocal8Bit(m_rsync.readAllStandardError())); emit warningMessage(QString::fromLocal8Bit(m_rsync.readAllStandardError()));
}); });
connect(&m_rsync, &QtcProcess::errorOccurred, this, [this] { connect(&m_rsync, &QtcProcess::done, this, [this] {
if (m_rsync.error() == QProcess::FailedToStart) { auto notifyError = [this](const QString &message) {
emit errorMessage(tr("rsync failed to start: %1").arg(m_rsync.errorString())); emit errorMessage(message);
setFinished(); setFinished();
} };
}); if (m_rsync.error() == QProcess::FailedToStart)
connect(&m_rsync, &QtcProcess::finished, this, [this] { notifyError(tr("rsync failed to start: %1").arg(m_rsync.errorString()));
if (m_rsync.exitStatus() == QProcess::CrashExit) { else if (m_rsync.exitStatus() == QProcess::CrashExit)
emit errorMessage(tr("rsync crashed.")); notifyError(tr("rsync crashed."));
setFinished(); else if (m_rsync.exitCode() != 0)
return; notifyError(tr("rsync failed with exit code %1.").arg(m_rsync.exitCode()));
} else
if (m_rsync.exitCode() != 0) { deployNextFile();
emit errorMessage(tr("rsync failed with exit code %1.").arg(m_rsync.exitCode()));
setFinished();
return;
}
deployNextFile();
}); });
deployNextFile(); deployNextFile();
} }