diff --git a/lib/masamune/actions/execute.rb b/lib/masamune/actions/execute.rb index 55a704c..d46dfba 100644 --- a/lib/masamune/actions/execute.rb +++ b/lib/masamune/actions/execute.rb @@ -56,7 +56,9 @@ def initialize(delegate) end end if block_given? - command = Masamune::Commands::Shell.new(klass.new(self), {fail_fast: false}.merge(opts)) + command = klass.new(self) + command = Masamune::Commands::RetryWithBackoff.new(command, opts) + command = Masamune::Commands::Shell.new(command, {fail_fast: false}.merge(opts)) opts.fetch(:interactive, false) ? command.replace(opts) : command.execute end end diff --git a/spec/masamune/actions/execute_spec.rb b/spec/masamune/actions/execute_spec.rb index 5b50b86..8f50e2e 100644 --- a/spec/masamune/actions/execute_spec.rb +++ b/spec/masamune/actions/execute_spec.rb @@ -39,6 +39,10 @@ def after_execute let(:instance) { klass.new } describe '.execute' do + before do + expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, anything).once.and_call_original + end + context 'with a simple command' do let(:command) { %w(echo ping) } let(:options) { {fail_fast: true} }