]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
Handle negative value in padding (#3389)
authorTreboko <redacted>
Sun, 24 Aug 2025 16:34:23 +0000 (18:34 +0200)
committerGitHub <redacted>
Sun, 24 Aug 2025 16:34:23 +0000 (01:34 +0900)
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

bindings/ruby/lib/whisper/model/uri.rb

index 5bf5a098624f15a0ecb1dbe091b0c61a79315471..d8a98699f07e00e247a3546e6f8d3ccddee2f40a 100644 (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