From 903fd3acdcd10370f13f59686cb104a77f2909f1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 1 Jun 2012 16:38:40 +0200 Subject: [PATCH] Easy operations API `local` now echoes stdout/stderr --- lib/vagrant/easy/operations.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/easy/operations.rb b/lib/vagrant/easy/operations.rb index 581403fb1..24114942f 100644 --- a/lib/vagrant/easy/operations.rb +++ b/lib/vagrant/easy/operations.rb @@ -44,9 +44,26 @@ module Vagrant # runtimes such as CRuby and JRuby. # # @param [String] command Command to run - def local(command) + # @param [Hash] options Additional options + def local(command, options=nil) @logger.info("local: #{command}") - Vagrant::Util::Subprocess.execute(command) + + block = nil + options = { :echo => true }.merge(options || {}) + + if options[:echo] + # If we're echoing data, then setup the block that sends the + # data to the UI. + block = Proc.new do |type, data| + if type == :stdout || type == :stderr + @vm.ui.info(data.to_s, + :prefix => false, + :new_line => false) + end + end + end + + Vagrant::Util::Subprocess.execute(command, &block) end # Run a shell command within the VM. The command will run within a