summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonutils.cpp
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/python/pythonutils.cpp
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/python/pythonutils.cpp')
-rw-r--r--src/plugins/python/pythonutils.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index 60639492c6..d693c2597b 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -86,8 +86,8 @@ static QString pythonName(const FilePath &pythonPath)
if (name.isEmpty()) {
SynchronousProcess pythonProcess;
pythonProcess.setTimeoutS(2);
- const CommandLine pythonVersionCommand(pythonPath, {"--version"});
- pythonProcess.runBlocking(pythonVersionCommand);
+ pythonProcess.setCommand({pythonPath, {"--version"}});
+ pythonProcess.runBlocking();
if (pythonProcess.result() != QtcProcess::Finished)
return {};
name = pythonProcess.allOutput().trimmed();
@@ -109,7 +109,8 @@ FilePath getPylsModulePath(CommandLine pylsCommand)
Environment env = pythonProcess.environment();
env.set("PYTHONVERBOSE", "x");
pythonProcess.setEnvironment(env);
- pythonProcess.runBlocking(pylsCommand);
+ pythonProcess.setCommand(pylsCommand);
+ pythonProcess.runBlocking();
static const QString pylsInitPattern = "(.*)"
+ QRegularExpression::escape(
@@ -159,12 +160,13 @@ static PythonLanguageServerState checkPythonLanguageServer(const FilePath &pytho
}
SynchronousProcess pythonProcess;
- pythonProcess.runBlocking(pythonLShelpCommand);
+ pythonProcess.setCommand(pythonLShelpCommand);
+ pythonProcess.runBlocking();
if (pythonProcess.allOutput().contains("Python Language Server"))
return {PythonLanguageServerState::AlreadyInstalled, modulePath};
- const CommandLine pythonPipVersionCommand(python, {"-m", "pip", "-V"});
- pythonProcess.runBlocking(pythonPipVersionCommand);
+ pythonProcess.setCommand({python, {"-m", "pip", "-V"}});
+ pythonProcess.runBlocking();
if (pythonProcess.allOutput().startsWith("pip "))
return {PythonLanguageServerState::CanBeInstalled, FilePath()};
else