From 000f5aba4f36e50ba2de35204823b2b97754e219 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 31 Aug 2021 11:50:19 +0200 Subject: [PATCH] Use QtcProcess for reading version number in meson project Change-Id: I8f7b72ae9d21fec5a7c8e9baf154dcba70a3a2b3 Reviewed-by: Artem Sokolovskii Reviewed-by: Alexis Jeandet Reviewed-by: hjk --- .../mesonprojectmanager/exewrappers/toolwrapper.cpp | 12 +++++++----- .../mesonprojectmanager/exewrappers/toolwrapper.h | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp index 2e2ad082874..d13175f5f4f 100644 --- a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp +++ b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp @@ -25,6 +25,8 @@ #include "toolwrapper.h" +#include + 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 {}; } diff --git a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h index a2000677453..68ea6d4fdea 100644 --- a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h +++ b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h @@ -34,7 +34,6 @@ #include #include -#include #include #include #include