[downloader]: Fix broken progress bar when content-length not provided (#8010)

* downloader: Fix broken progress bar

* Fix syntax error

* Fix variable scope

* Revert last changes

* Remove redundant space
This commit is contained in:
supechicken
2023-02-28 22:47:05 +08:00
committed by GitHub
parent 60808ffb50
commit 1b9266e84f
2 changed files with 9 additions and 19 deletions

View File

@@ -102,15 +102,10 @@ class ProgressBar
end
# stop when 100%
if @percentage >= 100
print "\e[2K\r" # clear previous line (progress bar)
break
else
print "\r"
end
@percentage >= 100 ? break : print("\r")
end
ensure
print "\e[?25h" # restore cursor mode since we hide it before
print "\e[2K\r\e[?25h" # clear line and restore cursor mode
end
end
end