diff --git a/src/lib_gui/utility/utilityApp.cpp b/src/lib_gui/utility/utilityApp.cpp index 2c7e287a..e548515d 100644 --- a/src/lib_gui/utility/utilityApp.cpp +++ b/src/lib_gui/utility/utilityApp.cpp @@ -147,11 +147,14 @@ int utility::executeProcessAndGetExitCode( bool logProcessOutput, std::wstring* errorMessage ){ + bool finished = false; + QProcess process; - if (errorMessage != nullptr) + QObject::connect(&process, &QProcess::errorOccurred, [&finished, errorMessage, commandPath](QProcess::ProcessError error) { - QObject::connect(&process, &QProcess::errorOccurred, [errorMessage, commandPath](QProcess::ProcessError error) + finished = true; + if (errorMessage != nullptr) { switch (error) { @@ -173,9 +176,15 @@ int utility::executeProcessAndGetExitCode( case QProcess::UnknownError: *errorMessage = L"An unknown error occurred while executing process."; break; - }; - }); - } + } + }; + }); + + QObject::connect(&process, static_cast(&QProcess::finished), [&finished](int exitCode, QProcess::ExitStatus exitStatus) + { + finished = true; + }); + if (!workingDirectory.empty()) { @@ -204,7 +213,7 @@ int utility::executeProcessAndGetExitCode( std::wstring errorBuffer; if (timeout == -1) { - while (!process.waitForFinished(1000)) + while (!finished && process.waitForFinished(1000)) { if (logProcessOutput) { @@ -214,7 +223,10 @@ int utility::executeProcessAndGetExitCode( } else { - process.waitForFinished(timeout); + if (!finished) + { + process.waitForFinished(timeout); + } } if (logProcessOutput) diff --git a/testing/project_setup/cpp_empty_pch/data/src/Bar.h b/testing/project_setup/cpp_empty_pch/data/src/Bar.h index 1cb93caf..4f95103a 100644 --- a/testing/project_setup/cpp_empty_pch/data/src/Bar.h +++ b/testing/project_setup/cpp_empty_pch/data/src/Bar.h @@ -1,5 +1,5 @@ -#ifndef FOO_H -#define FOO_H +#ifndef BAR_H +#define BAR_H #include "FooBar.h" @@ -7,4 +7,4 @@ class Bar : public FooBar { }; -#endif // FOO_H +#endif // BAR_H diff --git a/testing/project_setup/cpp_empty_pch/data/src/Foo.h b/testing/project_setup/cpp_empty_pch/data/src/Foo.h index 1ad18563..75082486 100644 --- a/testing/project_setup/cpp_empty_pch/data/src/Foo.h +++ b/testing/project_setup/cpp_empty_pch/data/src/Foo.h @@ -1,5 +1,5 @@ -#ifndef BAR_H -#define BAR_H +#ifndef FOO_H +#define FOO_H #include "FooBar.h" @@ -7,4 +7,4 @@ class Foo : public FooBar { }; -#endif // FOO_BAR_H +#endif // FOO_H diff --git a/testing/project_setup/custom_command_python/checklist.txt b/testing/project_setup/custom_command_python/checklist.txt index be4ab163..f379c002 100644 --- a/testing/project_setup/custom_command_python/checklist.txt +++ b/testing/project_setup/custom_command_python/checklist.txt @@ -10,7 +10,7 @@ * Click "Add Source Group" * Select "Custom" -> "Custom Command Source Group" * Click "Next" -* Add "python /SourcetrailPythonIndexer/run.py --source-file-path=%{SOURCE_FILE_PATH} --database-file-path=%{DATABASE_FILE_PATH}" to "Custom Command" +* Add "python /SourcetrailPythonIndexer/run.py index --source-file-path=%{SOURCE_FILE_PATH} --database-file-path=%{DATABASE_FILE_PATH}" to "Custom Command" * Add "./src" to "Files & Directories to Index" * Add "**main*" to "Excluded Files & Directories" * Add ".py" to "Source File Extensions" @@ -34,7 +34,7 @@ * Click "Save" * Validate a project-file-was-changed-notification appears * Click "Reindex" -* Validate "Updated files" is selected +* Validate "All files" is selected * Validate "source files to index" shows "3" * Click "Updated files" * Validate "source files to index" shows "1" @@ -43,7 +43,9 @@ * Click "OK" * Validate content of code and graph view changed and display calls from "main" * Run "2_update.sh" +* Click "Refresh" button * Validate "Updated files" is selected +* Validate "files to clear" shows "1" * Validate "source files to index" shows "1" * Click Start * Validate a dialog appears that states that the project cannot be partially cleared @@ -57,7 +59,8 @@ * Validate "Warning appears that %{SOURCE_FILE_PATH} is not defined in command" * In "Custom Command" replace "foo" with "%{SOURCE_FILE_PATH}" * Click "Save" -* Click "Refresh" button +* Validate a project-file-was-changed-notification appears +* Click "Reindex" * Click "Start" * Validate "Log View appears showing errors that command execution failed". * Close Sourcetrail