CommandLine: Reuse new c'tor

Change-Id: Id154881b4f5d8c488e5c1f5e0f843d36bf838759
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2024-05-16 14:07:59 +02:00
parent d857af4cec
commit 982ad24243
39 changed files with 104 additions and 165 deletions

View File

@@ -121,11 +121,9 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type)
return file.absolutePath();
};
const auto args = QStringList{"-i"} + replImportArgs(file, type);
const FilePath pythonCommand = detectPython(file);
Process process;
process.setCommand({pythonCommand, args});
process.setCommand({pythonCommand, {"-i", replImportArgs(file, type)}});
process.setWorkingDirectory(workingDir(file));
process.setTerminalMode(TerminalMode::Detached);
process.start();
@@ -201,7 +199,7 @@ static bool isUsableHelper(QHash<FilePath, bool> *cache, const QString &keyStrin
if (it == cache->end()) {
const Key key = keyFromString(keyString);
Process process;
process.setCommand({python, QStringList{"-m", commandArg, "-h"}});
process.setCommand({python, {"-m", commandArg, "-h"}});
process.runBlocking();
const bool usable = process.result() == ProcessResult::FinishedWithSuccess;
it = cache->insert(python, usable);