Proper capture on windows
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
d8e0b14dc4
commit
b7dd32274c
@ -280,8 +280,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
BindCrtHandlesToStdHandles(true, true, true);
|
||||
consoleAttached = true;
|
||||
}
|
||||
} else if (stdout_type == FILE_TYPE_DISK || stdout_type == FILE_TYPE_PIPE ) {
|
||||
BindCrtHandlesToStdHandles(true, true, true);
|
||||
}
|
||||
#endif
|
||||
setOrganizationName(BuildConfig.LAUNCHER_NAME);
|
||||
|
@ -184,7 +184,7 @@ QString StringUtils::getRandomAlphaNumeric()
|
||||
return QUuid::createUuid().toString(QUuid::Id128);
|
||||
}
|
||||
|
||||
QPair<QString, QString> splitFirst(const QString& s, const QString& sep, Qt::CaseSensitivity cs = Qt::CaseSensitive) {
|
||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QString& sep, Qt::CaseSensitivity cs) {
|
||||
QString left, right;
|
||||
auto index = s.indexOf(sep, 0, cs);
|
||||
left = s.mid(0, index);
|
||||
@ -192,7 +192,7 @@ QPair<QString, QString> splitFirst(const QString& s, const QString& sep, Qt::Cas
|
||||
return qMakePair(left, right);
|
||||
}
|
||||
|
||||
QPair<QString, QString> splitFirst(const QString& s, QChar sep, Qt::CaseSensitivity cs = Qt::CaseSensitive) {
|
||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, QChar sep, Qt::CaseSensitivity cs) {
|
||||
QString left, right;
|
||||
auto index = s.indexOf(sep, 0, cs);
|
||||
left = s.mid(0, index);
|
||||
@ -200,7 +200,7 @@ QPair<QString, QString> splitFirst(const QString& s, QChar sep, Qt::CaseSensitiv
|
||||
return qMakePair(left, right);
|
||||
}
|
||||
|
||||
QPair<QString, QString> splitFirst(const QString& s, const QRegularExpression& re) {
|
||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QRegularExpression& re) {
|
||||
QString left, right;
|
||||
auto index = s.indexOf(re);
|
||||
left = s.mid(0, index);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "StringUtils.h"
|
||||
|
||||
@ -80,6 +81,8 @@ void PrismExternalUpdater::checkForUpdates()
|
||||
QProgressDialog progress(tr("Checking for updates..."), "", 0, -1);
|
||||
progress.setCancelButton(nullptr);
|
||||
progress.show();
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
|
||||
QProcess proc;
|
||||
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
|
||||
@ -87,7 +90,7 @@ void PrismExternalUpdater::checkForUpdates()
|
||||
exe_name.append(".exe");
|
||||
#endif
|
||||
|
||||
QStringList args = { "--check-only" };
|
||||
QStringList args = { "--check-only", "--dir", priv->dataDir.absolutePath(), "--debug" };
|
||||
if (priv->allowBeta)
|
||||
args.append("--pre-release");
|
||||
|
||||
@ -97,6 +100,8 @@ void PrismExternalUpdater::checkForUpdates()
|
||||
auto err = proc.error();
|
||||
qDebug() << "Failed to start updater after 5 seconds." << "reason:" << err << proc.errorString();
|
||||
}
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
auto result_finished = proc.waitForFinished(60000);
|
||||
if (!result_finished) {
|
||||
auto err = proc.error();
|
||||
@ -108,6 +113,9 @@ void PrismExternalUpdater::checkForUpdates()
|
||||
auto std_output = proc.readAllStandardOutput();
|
||||
auto std_error = proc.readAllStandardError();
|
||||
|
||||
qDebug() << "captured output:" << std_output;
|
||||
qDebug() << "captured error:" << std_error;
|
||||
|
||||
switch (exit_code) {
|
||||
case 0:
|
||||
// no update available
|
||||
@ -188,6 +196,7 @@ void PrismExternalUpdater::resetAutoCheckTimer() {
|
||||
secs_left = 0;
|
||||
timeoutDuration = secs_left * 1000; // to msec
|
||||
}
|
||||
qDebug() << "Auto update timer starting," << timeoutDuration / 1000 << "seconds left";
|
||||
priv->updateTimer.start(timeoutDuration);
|
||||
} else {
|
||||
if (priv->updateTimer.isActive())
|
||||
@ -204,3 +213,7 @@ void PrismExternalUpdater::connectTimer() {
|
||||
void PrismExternalUpdater::disconnectTimer() {
|
||||
disconnect(&priv->updateTimer, &QTimer::timeout, this, &PrismExternalUpdater::autoCheckTimerFired);
|
||||
}
|
||||
|
||||
void PrismExternalUpdater::autoCheckTimerFired() {
|
||||
checkForUpdates();
|
||||
}
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include <QProgressDialog>
|
||||
#include <sys.h>
|
||||
#include <winbase.h>
|
||||
|
||||
#if defined Q_OS_WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
@ -210,10 +209,7 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
|
||||
BindCrtHandlesToStdHandles(true, true, true);
|
||||
consoleAttached = true;
|
||||
}
|
||||
} else if (stdout_type == FILE_TYPE_DISK || stdout_type == FILE_TYPE_PIPE ) {
|
||||
BindCrtHandlesToStdHandles(true, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
setOrganizationName(BuildConfig.LAUNCHER_NAME);
|
||||
setOrganizationDomain(BuildConfig.LAUNCHER_DOMAIN);
|
||||
|
Loading…
Reference in New Issue
Block a user