Tty.width: use tput cols when stty size returns 0;

bin/brew: add 'COLUMNS' and 'LINES' to env variables

Signed-off-by: lukertty <lukertty@gmail.com>
This commit is contained in:
lukertty 2018-05-30 12:29:24 +08:00
parent ca8bfef553
commit f308aa4800
No known key found for this signature in database
GPG Key ID: E705773C6357AD17
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ module Tty
def width
width = `/bin/stty size 2>/dev/null`.split[1]
width ||= `/usr/bin/tput cols 2>/dev/null`.split[0]
width = `/usr/bin/tput cols 2>/dev/null`.split[0] if width.to_i.zero?
width ||= 80
width.to_i
end

View File

@ -72,7 +72,7 @@ then
FILTERED_ENV=()
# Filter all but the specific variables.
for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \
for VAR in HOME SHELL PATH TERM COLUMNS LINES LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \
http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \
"${!HOMEBREW_@}" "${!TRAVIS_@}"
do