Treboko commited on
Commit
6e115ac
·
unverified ·
1 Parent(s): 0b65831

Handle negative value in padding (#3389)

Browse files

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 CHANGED
@@ -94,7 +94,7 @@ module Whisper
94
  end
95
 
96
  def show_progress(current, size)
97
- progress_rate_available = size && $stderr.tty?
98
 
99
  unless @prev
100
  @prev = Time.now
 
94
  end
95
 
96
  def show_progress(current, size)
97
+ progress_rate_available = size && $stderr.tty? && $stderr.winsize[1] >= line.size
98
 
99
  unless @prev
100
  @prev = Time.now