diff --git a/engine/controllers/process_manager.cc b/engine/controllers/process_manager.cc index 9d1604754..72b0f08d2 100644 --- a/engine/controllers/process_manager.cc +++ b/engine/controllers/process_manager.cc @@ -9,7 +9,13 @@ void ProcessManager::destroy( std::function&& callback) { auto loaded_engines = engine_service_->GetSupportedEngineNames(); for (const auto& engine : loaded_engines.value()) { - engine_service_->UnloadEngine(engine); + auto result = engine_service_->UnloadEngine(engine); + if (!result) { + // Handle the error if any. + // Log the Error + LOG_ERROR << "Error unloading engine: " << result.error(); + continue; + } } app().quit(); Json::Value ret; diff --git a/engine/services/hardware_service.cc b/engine/services/hardware_service.cc index 93b2d70f8..7ee5fbfb3 100644 --- a/engine/services/hardware_service.cc +++ b/engine/services/hardware_service.cc @@ -323,7 +323,14 @@ void HardwareService::UpdateHardwareInfos() { }; for (auto const& he : b.value()) { if (!exists(he.uuid)) { - db_service_->DeleteHardwareEntry(he.uuid); + auto result = db_service_->DeleteHardwareEntry(he.uuid); + if (!result) { + // Handle the error if any. + // Log the Error + LOG_ERROR << "Error deleting hardware entry " << he.uuid << ": " + << result.error(); + continue; + } } } diff --git a/engine/utils/command_executor.h b/engine/utils/command_executor.h index 2a6064521..6ad51c369 100644 --- a/engine/utils/command_executor.h +++ b/engine/utils/command_executor.h @@ -20,7 +20,7 @@ class CommandExecutor { if (!pipe) { throw std::runtime_error("popen() failed!"); } - m_pipe = std::unique_ptr(pipe, PCLOSE); + m_pipe = std::unique_ptr(pipe, [](FILE* file) { if (file) { PCLOSE(file); } }); } CommandExecutor(const CommandExecutor&) = delete; @@ -46,5 +46,5 @@ class CommandExecutor { } private: - std::unique_ptr m_pipe{nullptr, PCLOSE}; + std::unique_ptr m_pipe{nullptr, [](FILE* file) { if (file) { PCLOSE(file); } }}; };