Use QtcProcess for reading version number in meson project

Change-Id: I8f7b72ae9d21fec5a7c8e9baf154dcba70a3a2b3
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-08-31 11:50:19 +02:00
parent 87b3de0e39
commit 000f5aba4f
2 changed files with 7 additions and 6 deletions

View File

@@ -25,6 +25,8 @@
#include "toolwrapper.h" #include "toolwrapper.h"
#include <utils/qtcprocess.h>
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
@@ -60,11 +62,11 @@ void ToolWrapper::setExe(const Utils::FilePath &newExe)
Version ToolWrapper::read_version(const Utils::FilePath &toolPath) Version ToolWrapper::read_version(const Utils::FilePath &toolPath)
{ {
if (toolPath.toFileInfo().isExecutable()) { if (toolPath.toFileInfo().isExecutable()) {
QProcess process; Utils::QtcProcess process;
process.start(toolPath.toString(), {"--version"}); process.setCommand({ toolPath, { "--version" } });
if (process.waitForFinished()) { process.start();
return Version::fromString(QString::fromUtf8(process.readLine())); if (process.waitForFinished())
} return Version::fromString(process.stdOut());
} }
return {}; return {};
} }

View File

@@ -34,7 +34,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFileInfo> #include <QFileInfo>
#include <QProcess>
#include <QUuid> #include <QUuid>
#include <QVariant> #include <QVariant>
#include <QVariantMap> #include <QVariantMap>