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