From: Treboko Date: Sun, 24 Aug 2025 16:34:23 +0000 (+0200) Subject: Handle negative value in padding (#3389) X-Git-Tag: upstream/1.8.0~245 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=7745fcf32846006128f16de429cfe1677c963b30;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp 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 --- diff --git a/bindings/ruby/lib/whisper/model/uri.rb b/bindings/ruby/lib/whisper/model/uri.rb index 5bf5a098..d8a98699 100644 --- a/bindings/ruby/lib/whisper/model/uri.rb +++ b/bindings/ruby/lib/whisper/model/uri.rb @@ -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