Skip to content

Commit 41af60e

Browse files
committed
Use Qx::execute() for AM exe version
1 parent 4e7b716 commit 41af60e

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

app/src/launcher/implementation/attractmode/am-install_linux.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// Qx Includes
55
#include <qx/core/qx-regularexpression.h>
6+
#include <qx/core/qx-system.h>
67

78
namespace Am
89
{
@@ -12,24 +13,8 @@ namespace Am
1213

1314
QString Install::versionFromExecutable() const
1415
{
15-
QProcess attract;
16-
attract.setProgram(MAIN_EXE_PATH);
17-
attract.setArguments({"--version"});
18-
19-
attract.start();
20-
if(!attract.waitForStarted(1000))
21-
return QString();
22-
23-
if(!attract.waitForFinished(1000))
24-
{
25-
attract.kill(); // Force close
26-
attract.waitForFinished();
27-
28-
return QString();
29-
}
30-
31-
QString versionInfo = QString::fromLatin1(attract.readAllStandardOutput());
32-
QRegularExpressionMatch sv = Qx::RegularExpression::SEMANTIC_VERSION.match(versionInfo);
16+
ExecuteResult res = Qx::execute(MAIN_EXE_PATH, {"--version"}, 1000);
17+
QRegularExpressionMatch sv = Qx::RegularExpression::SEMANTIC_VERSION.match(res.output);
3318
return sv.hasMatch() ? sv.captured() : QString();
3419
}
3520

0 commit comments

Comments
 (0)