fix: add thread sleep to wait for resources - add detail text from logs

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-06-28 09:18:07 -07:00
parent 4123343130
commit 46e840fdf1
No known key found for this signature in database
GPG Key ID: E10E321EB160949B
3 changed files with 19 additions and 8 deletions

View File

@ -999,6 +999,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update In Progress"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort); auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update In Progress"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort);
msgBox.setDefaultButton(QMessageBox::Abort); msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true); msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
auto res = msgBox.exec(); auto res = msgBox.exec();
switch (res) { switch (res) {
case QMessageBox::Ignore: { case QMessageBox::Ignore: {
@ -1028,6 +1029,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Failed"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort); auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Failed"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort);
msgBox.setDefaultButton(QMessageBox::Abort); msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true); msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
auto res = msgBox.exec(); auto res = msgBox.exec();
switch (res) { switch (res) {
case QMessageBox::Ignore: { case QMessageBox::Ignore: {
@ -1056,7 +1058,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
.arg(update_log_path); .arg(update_log_path);
auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Succeeded"), infoMsg, QMessageBox::Ok); auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Succeeded"), infoMsg, QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.open(); msgBox.setDetailedText(FS::read(update_log_path));
msgBox.exec();
FS::deletePath(update_success_marker.absoluteFilePath()); FS::deletePath(update_success_marker.absoluteFilePath());
} }
} }

View File

@ -23,13 +23,14 @@
#include "PrismExternalUpdater.h" #include "PrismExternalUpdater.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDateTime> #include <QDateTime>
#include <QDebug>
#include <QDir> #include <QDir>
#include <QMessageBox>
#include <QProcess> #include <QProcess>
#include <QProgressDialog> #include <QProgressDialog>
#include <QSettings> #include <QSettings>
#include <QTimer> #include <QTimer>
#include <memory> #include <memory>
#include <QDebug>
#include "StringUtils.h" #include "StringUtils.h"
@ -117,9 +118,6 @@ void PrismExternalUpdater::checkForUpdates()
auto std_output = proc.readAllStandardOutput(); auto std_output = proc.readAllStandardOutput();
auto std_error = proc.readAllStandardError(); auto std_error = proc.readAllStandardError();
qDebug() << "captured output:" << std_output;
qDebug() << "captured error:" << std_error;
progress.hide(); progress.hide();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
@ -128,12 +126,17 @@ void PrismExternalUpdater::checkForUpdates()
// no update available // no update available
{ {
qDebug() << "No update available"; qDebug() << "No update available";
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."));
msgBox.exec();
} }
break; break;
case 1: case 1:
// there was an error // there was an error
{ {
qDebug() << "Updater subprocess error" << std_error; qDebug() << "Updater subprocess error" << qPrintable(std_error);
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Check Error"), tr("There was an error running the update check."));
msgBox.setDetailedText(std_error);
msgBox.exec();
} }
break; break;
case 100: case 100:
@ -264,14 +267,15 @@ void PrismExternalUpdater::offerUpdate(const QString& version_name, const QStrin
} }
} }
void PrismExternalUpdater::performUpdate(const QString& version_tag) { void PrismExternalUpdater::performUpdate(const QString& version_tag)
{
QProcess proc; QProcess proc;
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME); auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
#if defined Q_OS_WIN32 #if defined Q_OS_WIN32
exe_name.append(".exe"); exe_name.append(".exe");
#endif #endif
QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag }; QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag };
if (priv->allowBeta) if (priv->allowBeta)
args.append("--pre-release"); args.append("--pre-release");

View File

@ -617,6 +617,10 @@ void PrismUpdaterApp::run()
void PrismUpdaterApp::moveAndFinishUpdate(QDir target) void PrismUpdaterApp::moveAndFinishUpdate(QDir target)
{ {
logUpdate("Finishing update process"); logUpdate("Finishing update process");
logUpdate("Waiting 2 seconds for resources to free");
this->thread()->sleep(2);
auto manifest_path = FS::PathCombine(applicationDirPath(), "manifest.txt"); auto manifest_path = FS::PathCombine(applicationDirPath(), "manifest.txt");
QFileInfo manifest(manifest_path); QFileInfo manifest(manifest_path);