Module: Builderator::Util::Shell
- Included in:
- Tasks::Packer
- Defined in:
- lib/builderator/util/shell.rb
Overview
Extend the functionality of Thor::Actions::run
Defined Under Namespace
Classes: BufferTee
Instance Method Summary collapse
Instance Method Details
#execute(command, config = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/builderator/util/shell.rb', line 9 def execute(command, config = {}) return unless behavior == :invoke destination = relative_to_original_destination_root(destination_root, false) desc = "#{command} from #{destination.inspect}" if config[:with] desc = "#{File.basename(config[:with].to_s)} #{desc}" command = "#{config[:with]} #{command}" end say_status :run, desc, config.fetch(:verbose, true) BufferTee.new($stdout).tap do |t| IO.popen(command, :err => [:child, :out]).each { |l| t.write(l) } end unless [:pretend] end |