lib/vagrant/communication/ssh.rb in vagrantup-0.9.2 vs lib/vagrant/communication/ssh.rb in vagrantup-0.9.3
- old
+ new
@@ -2,18 +2,20 @@
require 'log4r'
require 'net/ssh'
require 'net/scp'
+require 'vagrant/util/ansi_escape_code_remover'
require 'vagrant/util/file_mode'
require 'vagrant/util/platform'
require 'vagrant/util/retryable'
module Vagrant
module Communication
# Provides communication with the VM via SSH.
class SSH < Base
+ include Util::ANSIEscapeCodeRemover
include Util::Retryable
def initialize(vm)
@vm = vm
@logger = Log4r::Logger.new("vagrant::communication::ssh")
@@ -167,19 +169,19 @@
ch.exec(shell) do |ch2, _|
# Setup the channel callbacks so we can get data and exit status
ch2.on_data do |ch3, data|
if block_given?
# Filter out the clear screen command
- data.gsub!("\e[H", "")
+ data = remove_ansi_escape_codes(data)
@logger.debug("stdout: #{data}")
yield :stdout, data
end
end
ch2.on_extended_data do |ch3, type, data|
if block_given?
# Filter out the clear screen command
- data.gsub!("\e[H", "")
+ data = remove_ansi_escape_codes(data)
@logger.debug("stderr: #{data}")
yield :stderr, data
end
end