Skip to content

Commit 4a7b334

Browse files
committed
Avoid divison-by-zero when total is zero
1 parent 1ee371f commit 4a7b334

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extras/formatting.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ track_progress() {
164164
local total=$1
165165
local current=0
166166

167-
while IFS= read -r _; do
167+
((total)) && while IFS= read -r _; do
168168
((current++)) || :
169169
percent=$((current * 100 / total))
170170
printf '\rProgress: [%-50s] %d%%' "$(printf '#%.0s' $(seq 1 $((percent / 2))))" "$percent" >&2

0 commit comments

Comments
 (0)