HTTP downloader clears the download line once its complete so that the log output doesn't wrap

This commit is contained in:
Mitchell Hashimoto 2010-02-28 22:34:07 -08:00
parent 3d220ef5c8
commit f5f1405a7c
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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