aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2020-01-06 13:32:26 +0100
committerOliver Wolff <oliver.wolff@qt.io>2020-01-08 06:54:25 +0000
commitc0aea890863fec449bf2fc00f5c46c06bc8a03a2 (patch)
tree5b224a2042e64cbfc06e5538e82ed8bd3dfa5721 /src
parentcfaa8cb70766dd6f43a95f355e4eb123b66e98b6 (diff)
msvcprobe: Read stdout in case of vswhere error
Older versions of vswhere do not know the "-utf8" switch and running them will result in an error. The actual error is shown in stdout instead of stderr though. Make sure that these errors are visible to the user. Change-Id: Ic526ad19bc201a62be24dd43b5094c24f2551d11 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index f2b53d6a5..c6061c2fa 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -99,6 +99,22 @@ static void addMSVCPlatform(Settings *settings, std::vector<Profile> &profiles,
profiles.push_back(p);
}
+static QString formatVswhereOutput(const QString &out, const QString &err)
+{
+ QString ret;
+ if (!out.isEmpty()) {
+ ret.append(Tr::tr("stdout")).append(QLatin1String(":\n"));
+ for (const QString &line : out.split(QLatin1Char('\n')))
+ ret.append(QLatin1Char('\t')).append(line).append(QLatin1Char('\n'));
+ }
+ if (!err.isEmpty()) {
+ ret.append(Tr::tr("stderr")).append(QLatin1String(":\n"));
+ for (const QString &line : err.split(QLatin1Char('\n')))
+ ret.append(QLatin1Char('\t')).append(line).append(QLatin1Char('\n'));
+ }
+ return ret;
+}
+
struct MSVCArchInfo
{
QString arch;
@@ -191,12 +207,15 @@ static std::vector<MSVCInstallInfo> retrieveInstancesFromVSWhere(ProductType pro
if (!vsWhere.waitForStarted(-1))
return result;
if (!vsWhere.waitForFinished(-1)) {
- qbsWarning() << Tr::tr("The vswhere tool failed to run: %1").arg(vsWhere.errorString());
+ qbsWarning() << Tr::tr("The vswhere tool failed to run").append(QLatin1String(": "))
+ .append(vsWhere.errorString());
return result;
}
if (vsWhere.exitCode() != 0) {
- qbsWarning() << Tr::tr("The vswhere tool failed to run: %1")
- .arg(QString::fromLocal8Bit(vsWhere.readAllStandardError()));
+ const QString stdOut = QString::fromLocal8Bit(vsWhere.readAllStandardOutput());
+ const QString stdErr = QString::fromLocal8Bit(vsWhere.readAllStandardError());
+ qbsWarning() << Tr::tr("The vswhere tool failed to run").append(QLatin1String(".\n"))
+ .append(formatVswhereOutput(stdOut, stdErr));
return result;
}
QJsonParseError parseError;