summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-05-17 12:02:42 +0200
committerhjk <hjk@qt.io>2021-05-19 13:01:51 +0000
commit90ad9024861641b5535eaa6d2dd302e3f04559ea (patch)
treeab540b1d1fcb8b78a1f3dd2d9dd4145a70e4d883 /src/plugins/projectexplorer
parent2db9ebc61504c5455f1fb2b4ed2a1cb6115ccbfa (diff)
downloadqt-creator-90ad9024861641b5535eaa6d2dd302e3f04559ea.tar.gz
Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}
Makes run() more similar to what start() looks like. Also add some asserts to make sure run() and related functions are only called on SyncronousProcesses, as these are currently the only ones where this works. Change-Id: Idee6076c3f40a484db5c17f5bb348698cc83d220 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp3
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp4
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp17
3 files changed, 15 insertions, 9 deletions
diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
index 62c9308527..90f4ba3ba7 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
@@ -112,7 +112,8 @@ static bool
if (CustomWizard::verbose())
qDebug("In %s, running:\n%s\n", qPrintable(workingDirectory),
qPrintable(cmd.toUserOutput()));
- process.run(cmd);
+ process.setCommand(cmd);
+ process.run();
if (process.result() != Utils::QtcProcess::Finished) {
*errorMessage = QString("Generator script failed: %1").arg(process.exitMessage());
const QString stdErr = process.stdErr();
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 80dfa42ca1..b881b88977 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -87,8 +87,8 @@ static QByteArray runGcc(const FilePath &gcc, const QStringList &arguments, cons
cpp.setEnvironment(environment);
cpp.setTimeoutS(10);
- CommandLine cmdLine(gcc, arguments);
- cpp.runBlocking(cmdLine);
+ cpp.setCommand({gcc, arguments});
+ cpp.runBlocking();
if (cpp.result() != QtcProcess::Finished || cpp.exitCode() != 0) {
Core::MessageManager::writeFlashing({"Compiler feature detection failure!",
cpp.exitMessage(),
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index 892a8421d5..17319f1ced 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -238,9 +238,9 @@ static QVector<VisualStudioInstallation> detectVisualStudioFromVsWhere(const QSt
vsWhereProcess.setCodec(QTextCodec::codecForName("UTF-8"));
const int timeoutS = 5;
vsWhereProcess.setTimeoutS(timeoutS);
- const CommandLine cmd(vswhere,
- {"-products", "*", "-prerelease", "-legacy", "-format", "json", "-utf8"});
- vsWhereProcess.runBlocking(cmd);
+ vsWhereProcess.setCommand({vswhere,
+ {"-products", "*", "-prerelease", "-legacy", "-format", "json", "-utf8"}});
+ vsWhereProcess.runBlocking();
switch (vsWhereProcess.result()) {
case QtcProcess::Finished:
break;
@@ -621,7 +621,8 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
if (language() == ProjectExplorer::Constants::C_LANGUAGE_ID)
arguments << QLatin1String("/TC");
arguments << toProcess << QLatin1String("/EP") << saver.filePath().toUserOutput();
- cpp.runBlocking({binary, arguments});
+ cpp.setCommand({binary, arguments});
+ cpp.runBlocking();
if (cpp.result() != QtcProcess::Finished || cpp.exitCode() != 0)
return predefinedMacros;
@@ -1495,7 +1496,8 @@ static const MsvcToolChain *findMsvcToolChain(const QString &displayedVarsBat)
static QVersionNumber clangClVersion(const QString &clangClPath)
{
SynchronousProcess clangClProcess;
- clangClProcess.runBlocking({clangClPath, {"--version"}});
+ clangClProcess.setCommand({clangClPath, {"--version"}});
+ clangClProcess.runBlocking();
if (clangClProcess.result() != QtcProcess::Finished || clangClProcess.exitCode() != 0)
return {};
const QRegularExpressionMatch match = QRegularExpression(
@@ -1721,6 +1723,8 @@ Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
arguments.append(gccPredefinedMacrosOptions(language()));
arguments.append("-");
cpp.runBlocking({clangPath(), arguments});
+ cpp.setCommand({compilerCommand(), arguments});
+ cpp.runBlocking();
if (cpp.result() != Utils::QtcProcess::Finished || cpp.exitCode() != 0) {
// Show the warning but still parse the output.
QTC_CHECK(false && "clang-cl exited with non-zero code.");
@@ -2058,7 +2062,8 @@ Utils::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils:
qDebug() << "readEnvironmentSetting: " << call << cmd.toUserOutput()
<< " Env: " << runEnv.size();
run.setCodec(QTextCodec::codecForName("UTF-8"));
- run.runBlocking(cmd);
+ run.setCommand(cmd);
+ run.runBlocking();
if (run.result() != QtcProcess::Finished) {
const QString message = !run.stdErr().isEmpty() ? run.stdErr() : run.exitMessage();