Use QtcProcess in NimToolChain

Change-Id: If45fe607cb17387692f9350166d1382090a9a50a
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-11-03 15:27:04 +01:00
parent 18f1be58e7
commit 19205e10af

View File

@@ -29,9 +29,9 @@
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/qtcprocess.h>
#include <QFileInfo> #include <QFileInfo>
#include <QProcess>
#include <QRegularExpression> #include <QRegularExpression>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -116,11 +116,12 @@ bool NimToolChain::fromMap(const QVariantMap &data)
bool NimToolChain::parseVersion(const FilePath &path, std::tuple<int, int, int> &result) bool NimToolChain::parseVersion(const FilePath &path, std::tuple<int, int, int> &result)
{ {
QProcess process; QtcProcess process;
process.start(path.toString(), {"--version"}); process.setCommand({path, {"--version"}});
process.start();
if (!process.waitForFinished()) if (!process.waitForFinished())
return false; return false;
const QString version = QString::fromUtf8(process.readLine()); const QString version = QString::fromUtf8(process.readAllStandardOutput()).section('\n', 0, 0);
if (version.isEmpty()) if (version.isEmpty())
return false; return false;
const QRegularExpression regex("(\\d+)\\.(\\d+)\\.(\\d+)"); const QRegularExpression regex("(\\d+)\\.(\\d+)\\.(\\d+)");