Call ExecuteCommandProcessFinishedHandler for notification and event commands

This commit is contained in:
Mattia Codato 2020-07-15 09:14:01 +02:00
parent 300bc89cb6
commit 27f8bc5920
2 changed files with 14 additions and 4 deletions

View File

@ -36,9 +36,14 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
int timeout = commandObj->GetTimeout(); int timeout = commandObj->GetTimeout();
std::function<void(const Value& commandLine, const ProcessResult&)> callback;
if (Checkable::ExecuteCommandProcessFinishedHandler) {
callback = Checkable::ExecuteCommandProcessFinishedHandler;
} else {
callback = std::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2);
}
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
resolvers, resolvedMacros, useResolvedMacros, timeout, resolvers, resolvedMacros, useResolvedMacros, timeout, callback);
std::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2));
} }
void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr) void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)

View File

@ -53,9 +53,14 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
int timeout = commandObj->GetTimeout(); int timeout = commandObj->GetTimeout();
std::function<void(const Value& commandLine, const ProcessResult&)> callback;
if (Checkable::ExecuteCommandProcessFinishedHandler) {
callback = Checkable::ExecuteCommandProcessFinishedHandler;
} else {
callback = std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2);
}
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers, PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers,
resolvedMacros, useResolvedMacros, timeout, resolvedMacros, useResolvedMacros, timeout, callback);
std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2));
} }
void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr) void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)