Skip to content

Commit a5c4808

Browse files
committed
- Fixed failing unit test: TestWorkspace.testImportDirectoryUtf8.
- Enabled printing services status on CI servers. This will allow debugging failing unit test: TestPlugins.testServices. - Fixed a bug in sa_plugin_services.cpp to get correct error messages in logs.
1 parent 2c8e61a commit a5c4808

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ matrix:
6060
fast_finish: true
6161

6262
before_build:
63-
#- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\list_services_status.bat
63+
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\list_services_status.bat
6464
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_doxygen.bat
6565
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_googletest.bat
6666
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_tinyxml2.bat

src/plugins/sa_plugin_services/sa_plugin_services.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void get_service_last_error(DWORD * error_code, char ** buffer, size_t * buffer_
5555
NULL, (*error_code), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
5656

5757
//Copy the error message into the output buffer.
58-
char* message_copy = _strdup(messageBuffer);
58+
*buffer = _strdup(messageBuffer);
5959
*buffer_size = size;
6060

6161
//Free the Win32's string's buffer.
@@ -87,7 +87,7 @@ const char* get_service_status(const char* name)
8787
get_service_last_error(&win32_error_code, &error_desc, &error_desc_size);
8888

8989
// Print a nice logging message
90-
sa_logging_print_format(SA_LOG_LEVEL_WARNING, PLUGIN_NAME_IDENTIFIER, "Failed openning service '%s'. Error: %u, %s.", name, win32_error_code, error_desc);
90+
sa_logging_print_format(SA_LOG_LEVEL_WARNING, PLUGIN_NAME_IDENTIFIER, "Failed openning service '%s'. Error: 0x%x, %s.", name, win32_error_code, error_desc);
9191

9292
// Cleanup
9393
free(error_desc);
@@ -107,7 +107,7 @@ const char* get_service_status(const char* name)
107107
get_service_last_error(&win32_error_code, &error_desc, &error_desc_size);
108108

109109
// Print a nice logging message
110-
sa_logging_print_format(SA_LOG_LEVEL_WARNING, PLUGIN_NAME_IDENTIFIER, "QueryServiceStatusEx has failed for service '%s'. Error: %u, %s.", name, win32_error_code, error_desc);
110+
sa_logging_print_format(SA_LOG_LEVEL_WARNING, PLUGIN_NAME_IDENTIFIER, "QueryServiceStatusEx has failed for service '%s'. Error: 0x%x, %s.", name, win32_error_code, error_desc);
111111

112112
// Cleanup
113113
free(error_desc);

src/tests/Workspace.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ namespace shellanything
121121
{
122122
const std::string& source_file = files[i];
123123

124+
// Check that values returned by FindFilesUtf8() are actually files and not directories.
125+
if (ra::filesystem::DirectoryExistsUtf8(source_file.c_str()))
126+
continue;
127+
124128
//Remove the parent path of the source directory to make the file paths relative to the parent directory.
125129
std::string target_relative = source_file;
126130
target_relative.replace(0, parent_dir.size(), ""); //make the source relative

0 commit comments

Comments
 (0)