Class: Duty::Tasks::Base::Shell

Inherits:
Command
  • Object
show all
Defined in:
lib/duty/tasks.rb

Instance Method Summary collapse

Methods inherited from Command

#description, #error, #initialize, #logger, run, #success?

Constructor Details

This class inherits a constructor from Duty::Tasks::Base::Command

Instance Method Details

#executeObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/duty/tasks.rb', line 153

def execute
  if !cmd
    @success = true
    return
  end

  begin
    @stdout, @stderr, @status = Open3.capture3(cmd)
    @success = true if status.success?
  rescue Exception => e
    @error = "ERROR: #{e.inspect}"
  ensure
    @logger << summary 
    @logger << error
  end
end