diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fddc1851..7e398e731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.7.3 (unreleased) - + - Fix issue with unknown terminal type output for sudo commands. ## 0.7.2 (February 8, 2011) diff --git a/lib/vagrant/provisioners/chef_solo.rb b/lib/vagrant/provisioners/chef_solo.rb index 59276de32..eb81a825d 100644 --- a/lib/vagrant/provisioners/chef_solo.rb +++ b/lib/vagrant/provisioners/chef_solo.rb @@ -65,8 +65,11 @@ module Vagrant env.ui.info I18n.t("vagrant.provisioners.chef.running_solo") vm.ssh.execute do |ssh| ssh.sudo!(commands) do |channel, type, data| - ssh.check_exit_status(data, commands) if type == :exit_status - env.ui.info("#{data}: #{type}") if type != :exit_status + if type == :exit_status + ssh.check_exit_status(data, commands) + else + env.ui.info("#{data}: #{type}") + end end end end diff --git a/lib/vagrant/ssh/session.rb b/lib/vagrant/ssh/session.rb index 123bb213a..d9e997b00 100644 --- a/lib/vagrant/ssh/session.rb +++ b/lib/vagrant/ssh/session.rb @@ -35,6 +35,9 @@ module Vagrant def sudo!(commands, options=nil, &block) channel = session.open_channel do |ch| ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success| + # Set the terminal + ch2.send_data "export TERM=vt100\n" + # Output each command as if they were entered on the command line [commands].flatten.each do |command| ch2.send_data "#{command}\n" @@ -85,6 +88,9 @@ module Vagrant # Output stdout data to the block channel.on_data do |ch2, data| + # This clears the screen, we want to filter it out. + data.gsub!("\e[H", "") + block.call(ch2, :stdout, data) end