diff options
Diffstat (limited to 'lib/chef/event_dispatch')
-rw-r--r-- | lib/chef/event_dispatch/dispatcher.rb | 10 | ||||
-rw-r--r-- | lib/chef/event_dispatch/events_output_stream.rb | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/chef/event_dispatch/dispatcher.rb b/lib/chef/event_dispatch/dispatcher.rb index f3e55539a9..affac8fb9d 100644 --- a/lib/chef/event_dispatch/dispatcher.rb +++ b/lib/chef/event_dispatch/dispatcher.rb @@ -20,6 +20,16 @@ class Chef @subscribers << subscriber end + # Check to see if we are dispatching to a formatter + def formatter? + @subscribers.each do |s| + if s.class <= Chef::Formatters::Base && s.class != Chef::Formatters::NullFormatter + return true + end + end + false + end + #### # All messages are unconditionally forwarded to all subscribers, so just # define the forwarding in one go: diff --git a/lib/chef/event_dispatch/events_output_stream.rb b/lib/chef/event_dispatch/events_output_stream.rb index 8de9b0fed1..d9c21642b7 100644 --- a/lib/chef/event_dispatch/events_output_stream.rb +++ b/lib/chef/event_dispatch/events_output_stream.rb @@ -21,6 +21,14 @@ class Chef events.stream_output(self, str, options) end + def <<(str) + events.stream_output(self, str, options) + end + + def write(str) + events.stream_output(self, str, options) + end + def close events.stream_closed(self, options) end |