diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-05-06 06:15:48 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-05-06 06:15:48 +0000 |
commit | b74a242e32782c4ddb6e6b236e120b0960f03402 (patch) | |
tree | d234cb178aab617b6524cdc6c846986d1592d396 | |
parent | Fix typo. (diff) | |
download | eselect-b74a242e32782c4ddb6e6b236e120b0960f03402.tar.gz eselect-b74a242e32782c4ddb6e6b236e120b0960f03402.tar.bz2 eselect-b74a242e32782c4ddb6e6b236e120b0960f03402.zip |
Don't test for tty within command substitution.backups/eselect-1.0.x@596
svn path=/branches/branch-1.0.x/; revision=527
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libs/output.bash.in | 10 |
2 files changed, 11 insertions, 6 deletions
@@ -1,3 +1,10 @@ +2009-05-06 Ulrich Mueller <ulm@gentoo.org> + + * libs/output.bash.in (write_kv_list_entry): Call get_column_width + only if stdout is a tty. + (get_column_width): Revert change of 2009-04-15; we can't test for + stdout being a tty when called via command substitution. + 2009-04-18 Ulrich Mueller <ulm@gentoo.org> + Release: 1.0.12 diff --git a/libs/output.bash.in b/libs/output.bash.in index 628acf5..63f308c 100644 --- a/libs/output.bash.in +++ b/libs/output.bash.in @@ -115,8 +115,9 @@ write_kv_list_entry() { echo -n -e "${right}" fi - local cols=$(get_column_width) \ + local cols=${COLS:-80} \ cwords="$(apply_text_highlights "${right}" "${val}")" + [[ -t 1 ]] && cols=$(get_column_width) text=${val//\%%%??%%%/} # only loop if it doesn't fit on the same line @@ -190,11 +191,8 @@ write_numbered_list() { # Get current column width get_column_width() { if [[ -z "${COLS}" ]] ; then - COLS=79 - if [[ -t 1 ]] ; then - COLS=( $(stty size 2>/dev/null) ) - is_number "${COLS[1]}" && COLS=${COLS[1]} || COLS=79 - fi + COLS=( $(stty size 2>/dev/null) ) + is_number "${COLS[1]}" && COLS=${COLS[1]} || COLS=79 fi echo -n ${COLS} |