split command line args for IndexerCommandCustom usages

* this seems to be required when using the new QProcess API.
* this also required to remove quotes that were added to path args because otherwise the Python indexer would mistake absolute paths for relative paths.
This commit is contained in:
mlangkabel
2021-01-25 20:36:42 +01:00
parent 093261232c
commit ecfa1b7920
17 changed files with 203 additions and 76 deletions
@@ -465,9 +465,12 @@ void TaskExecuteCustomCommands::runIndexerCommand(
indexedSourceFileCount + 1, indexedSourceFileCount, m_indexerCommandCount, {sourcePath});
MessageIndexingStatus(true, indexedSourceFileCount * 100 / m_indexerCommandCount).dispatch();
const std::wstring command = indexerCommand->getCustomCommand();
const std::wstring command = indexerCommand->getCommand();
const std::vector<std::wstring> arguments = indexerCommand->getArguments();
LOG_INFO("Start processing command \"" + utility::encodeToUtf8(command) + "\"");
LOG_INFO(
"Start processing command \"" +
utility::encodeToUtf8(command + L" " + utility::join(arguments, L" ")) + "\"");
const ErrorCountInfo previousErrorCount = storage ? storage->getErrorCount()
: ErrorCountInfo();
@@ -475,7 +478,7 @@ void TaskExecuteCustomCommands::runIndexerCommand(
LOG_INFO("Starting to index");
std::wstring errorMessage;
const int result = utility::executeProcessAndGetExitCode(
command, {}, m_projectDirectory, -1, true, &errorMessage);
command, arguments, m_projectDirectory, -1, true, &errorMessage);
LOG_INFO("Finished indexing");
if (storage)
@@ -508,8 +511,9 @@ void TaskExecuteCustomCommands::runIndexerCommand(
}
else
{
std::wstring statusText = L"command \"" + indexerCommand->getCustomCommand() +
L"\" returned";
std::wstring statusText = L"command \"" + indexerCommand->getCommand() + L" " +
utility::join(arguments, L" ") + L"\" returned";
if (result != 0)
{
statusText += L" code \"" + std::to_wstring(result) + L"\"";