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

View File

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