From f5f1405a7cf91673247aa43900f3bce147b5d60c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 28 Feb 2010 22:34:07 -0800 Subject: [PATCH] HTTP downloader clears the download line once its complete so that the log output doesn't wrap --- lib/vagrant/downloaders/http.rb | 7 +++++++ test/vagrant/downloaders/http_test.rb | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/vagrant/downloaders/http.rb b/lib/vagrant/downloaders/http.rb index ebc0fd030..1207e688f 100644 --- a/lib/vagrant/downloaders/http.rb +++ b/lib/vagrant/downloaders/http.rb @@ -28,6 +28,8 @@ module Vagrant destination_file.write(segment) end end + + complete_progress end def report_progress(progress, total) @@ -35,6 +37,11 @@ module Vagrant print "#{CL_RESET}Download Progress: #{percent.to_i}% (#{progress} / #{total})" $stdout.flush end + + def complete_progress + # Just clear the line back out + print "#{CL_RESET}" + end end end end \ No newline at end of file diff --git a/test/vagrant/downloaders/http_test.rb b/test/vagrant/downloaders/http_test.rb index 769ce255d..b58fa2060 100644 --- a/test/vagrant/downloaders/http_test.rb +++ b/test/vagrant/downloaders/http_test.rb @@ -4,6 +4,7 @@ class HttpDownloaderTest < Test::Unit::TestCase setup do @downloader, @tempfile = mock_downloader(Vagrant::Downloaders::HTTP) @downloader.stubs(:report_progress) + @downloader.stubs(:complete_progress) @uri = "foo.box" end