Class: DTR::Cmd
Class Method Summary collapse
Class Method Details
.execute(cmd) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dtr/shared/utils/cmd.rb', line 19 def self.execute(cmd) return true if cmd.nil? || cmd.empty? DTR.info {"Executing: #{cmd.inspect}"} output = %x[#{cmd} 2>&1] # don't put the following message into a block which maybe passed to remote process status = $?.exitstatus DTR.info {"Execution is done, status: #{status}"} DTR.error "#{cmd.inspect} output:\n#{output}" if status != 0 $?.exitstatus == 0 end |