From 74e9baf667dd0637363f7a5dc62b9244703ff02f Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 8 Oct 2022 13:26:53 +0900 Subject: [PATCH] utils/ipc-tap: Check if a hook is present before executing it When ipc-tap calls per-topic hooks, it does not check if a hook was set, causing an error to be emitted when no hook for a topic was set. This commit modifies ipc-tap so that it checks if a hook is set before executing it. --- utils/ipc-tap.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/ipc-tap.sh b/utils/ipc-tap.sh index df49a13..265c1d9 100755 --- a/utils/ipc-tap.sh +++ b/utils/ipc-tap.sh @@ -67,8 +67,12 @@ invoke_hooks() { local message="$2" local data + local hook + + hook="${hooks[$topic]}" - if data=$("${hooks[$topic]}" <<< "$message") && + if [[ -n "$hook" ]] && + data=$("$hook" <<< "$message") && [[ -n "$data" ]]; then output_message "HookData" "$data" fi -- 2.47.3