Fix cURL parsing with invalid blanks

This commit is contained in:
Mitchell Hashimoto 2013-03-17 12:05:53 -07:00
parent d1e2596ce5
commit 87f7cba16b
1 changed files with 13 additions and 14 deletions

View File

@ -64,25 +64,24 @@ module Vagrant
progress_data.gsub!(match[1], "") progress_data.gsub!(match[1], "")
# Ignore the first \r and split by whitespace to grab the columns # Ignore the first \r and split by whitespace to grab the columns
columns = data[1..-1].split(/\s+/) columns = data.strip.split(/\s+/)
# COLUMN DATA: # COLUMN DATA:
# #
# 0 - blank # 0 - % total
# 1 - % total # 1 - Total size
# 2 - Total size # 2 - % received
# 3 - % received # 3 - Received size
# 4 - Received size # 4 - % transferred
# 5 - % transferred # 5 - Transferred size
# 6 - Transferred size # 6 - Average download speed
# 7 - Average download speed # 7 - Average upload speed
# 8 - Average upload speed
# 9 - Total time # 9 - Total time
# 10 - Time spent # 9 - Time spent
# 11 - Time left # 10 - Time left
# 12 - Current speed # 11 - Current speed
output = "Progress: #{columns[1]}% (Rate: #{columns[12]}/s, Estimated time remaining: #{columns[11]})" output = "Progress: #{columns[0]}% (Rate: #{columns[11]}/s, Estimated time remaining: #{columns[10]})"
@ui.clear_line @ui.clear_line
@ui.info(output, :new_line => false) @ui.info(output, :new_line => false)
end end