diff --git a/lib/aruba/api/command.rb b/lib/aruba/api/command.rb index 7455ba68f..ec0794f27 100644 --- a/lib/aruba/api/command.rb +++ b/lib/aruba/api/command.rb @@ -228,9 +228,18 @@ def run_simple(*args) } end + # Prevent duplicate announce + activated = [:stdout, :stderr].select do |channel| + aruba.announcer.activated?(channel) + end + aruba.announcer.deactivate(*activated) + command = run(cmd, opts) command.stop + # Reenable for stop_all_commands + aruba.announcer.activate(*activated) + if Aruba::VERSION < '1' @last_exit_status = command.exit_status @timed_out = command.timed_out? diff --git a/lib/aruba/platforms/announcer.rb b/lib/aruba/platforms/announcer.rb index 75c9573ba..865dc10f8 100644 --- a/lib/aruba/platforms/announcer.rb +++ b/lib/aruba/platforms/announcer.rb @@ -139,6 +139,15 @@ def activate(*chns) self end + # Deactivates a channel + # + # @param [Symbol] channel + # The name of the channel to activate + def deactivate(*chns) + chns.flatten.each { |c| channels[c.to_sym] = false } + self + end + # Announce information to channel # # @param [Symbol] channel