diff --git a/lib/datadog/core/utils/at_fork_monkey_patch.rb b/lib/datadog/core/utils/at_fork_monkey_patch.rb index dbb99a6ebd3..13d45863cef 100644 --- a/lib/datadog/core/utils/at_fork_monkey_patch.rb +++ b/lib/datadog/core/utils/at_fork_monkey_patch.rb @@ -73,7 +73,7 @@ def _fork pid = super - datadog_at_fork_blocks[:child].each(&:call) if datadog_at_fork_blocks.key?(:child) && pid == 0 + datadog_at_fork_blocks[:child].each(&:call) if pid == 0 && datadog_at_fork_blocks.key?(:child) pid end