Handle negative value in padding (#3389)

this might happen depending on the way the $stderr.winsize is defined. If the expression "$stderr.winsize[1] - line.size" in Line 114 gets negative, we will get a "negative argument" exception in the padding calculation
This commit is contained in:
Treboko
2025-08-24 18:34:23 +02:00
committed by GitHub
parent c09b0e0c4c
commit 7745fcf328

View File

@@ -94,7 +94,7 @@ module Whisper
end
def show_progress(current, size)
progress_rate_available = size && $stderr.tty?
progress_rate_available = size && $stderr.tty? && $stderr.winsize[1] >= line.size
unless @prev
@prev = Time.now