From c14f30a99bc8dfddb9b1e081b5f4e33ddffe0926 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 29 Jun 2022 17:36:36 +0200 Subject: [PATCH] McuSupport: Use allOutput() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of self constructed mixture of output and error. Change-Id: I3937a861f6e629f5613cd365486386e2a2db29b3 Reviewed-by: Reviewed-by: Piotr Mućko Reviewed-by: hjk --- src/plugins/mcusupport/mcusupportversiondetection.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportversiondetection.cpp b/src/plugins/mcusupport/mcusupportversiondetection.cpp index 00156d1c7c7..2ac9b99c28e 100644 --- a/src/plugins/mcusupport/mcusupportversiondetection.cpp +++ b/src/plugins/mcusupport/mcusupportversiondetection.cpp @@ -60,22 +60,20 @@ McuPackageExecutableVersionDetector::McuPackageExecutableVersionDetector( QString McuPackageExecutableVersionDetector::parseVersion(const FilePath &packagePath) const { if (m_detectionPath.isEmpty() || m_detectionRegExp.isEmpty()) - return QString(); + return {}; const FilePath binaryPath = packagePath / m_detectionPath.path(); if (!binaryPath.exists()) - return QString(); + return {}; const int timeout = 3000; // usually runs below 1s, but we want to be on the safe side QtcProcess process; process.setCommand({binaryPath, m_detectionArgs}); process.start(); if (!process.waitForFinished(timeout) || process.result() != ProcessResult::FinishedWithSuccess) - return QString(); + return {}; - const QString processOutput = QString::fromUtf8( - process.readAllStandardOutput().append(process.readAllStandardError())); - return matchRegExp(processOutput, m_detectionRegExp); + return matchRegExp(process.allOutput(), m_detectionRegExp); } McuPackageXmlVersionDetector::McuPackageXmlVersionDetector(const QString &filePattern,