aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2010-01-16 13:12:38 +0000
committerMax Howell2010-01-16 13:12:38 +0000
commitd1355af66ed9452a7ebd4b8bdd20f19359f3f1f2 (patch)
tree5603936f48830b4730385360a5b5ec0e8aa94b6c /Library/Homebrew
parent056851463eadbc0c9b81ae96f6251d66ec5b64ec (diff)
downloadbrew-d1355af66ed9452a7ebd4b8bdd20f19359f3f1f2.tar.bz2
Check for bad values of console_width
Fixes Homebrew/homebrew#453.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/utils.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index f8965d090..79f739826 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -123,7 +123,8 @@ def puts_columns items, cols = 4
items.concat("\n") unless items.empty?
# determine the best width to display for different console sizes
- console_width = `/bin/stty size`.chomp.split(" ").last
+ console_width = `/bin/stty size`.chomp.split(" ").last.to_i
+ console_width = 80 if console_width <= 0
longest = items.sort_by { |item| item.length }.last
optimal_col_width = (console_width.to_f / (longest.length + 2).to_f).floor
cols = optimal_col_width > 1 ? optimal_col_width : 1