Merge pull request #789 from dansimau/master
Fix for #788. Prevents FloatDomainError when downloading a box and no content-length header is present
This commit is contained in:
commit
7837221773
|
@ -78,9 +78,13 @@ module Vagrant
|
|||
# to the UI. Send `clear_line` to clear the line to show
|
||||
# a continuous progress meter.
|
||||
def report_progress(progress, total, show_parts=true)
|
||||
percent = (progress.to_f / total.to_f) * 100
|
||||
line = "Progress: #{percent.to_i}%"
|
||||
line << " (#{progress} / #{total})" if show_parts
|
||||
if total and not total == 0
|
||||
percent = (progress.to_f / total.to_f) * 100
|
||||
line = "Progress: #{percent.to_i}%"
|
||||
line << " (#{progress} / #{total})" if show_parts
|
||||
else
|
||||
line = "Progress: #{progress}"
|
||||
end
|
||||
|
||||
info(line, :new_line => false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue