summaryrefslogtreecommitdiffstats
path: root/bin/isolated-functions.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-11-05 11:53:20 -0700
committerZac Medico <zmedico@gentoo.org>2011-11-05 11:53:20 -0700
commit7c5e61b3f442b8ca2e75a08bf34eb65eec285b93 (patch)
tree5b765b21d9b3d8fd4250e6a04bf02edee2996d71 /bin/isolated-functions.sh
parentab484dc9a2612aa6709fad3ff926c8589a706637 (diff)
downloadportage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.tar.gz
portage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.tar.bz2
portage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.zip
Enable colors during the depend phase.
Diffstat (limited to 'bin/isolated-functions.sh')
-rw-r--r--bin/isolated-functions.sh27
1 files changed, 13 insertions, 14 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 733795aa1..d2ea319bd 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -411,7 +411,11 @@ unset_colors() {
set_colors() {
COLS=${COLUMNS:-0} # bash's internal COLUMNS variable
- (( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
+ # Avoid wasteful stty calls during the "depend" phases.
+ # If stdout is a pipe, the parent process can export COLUMNS
+ # if it's relevant.
+ [[ $COLS == 0 && $EBUILD_PHASE != depend ]] && \
+ COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
(( COLS > 0 )) || (( COLS = 80 ))
# Now, ${ENDCOL} will move us to the end of the
@@ -434,19 +438,14 @@ RC_INDENTATION=''
RC_DEFAULT_INDENT=2
RC_DOT_PATTERN=''
-if [[ $EBUILD_PHASE == depend ]] ; then
- # avoid unneeded stty call in set_colors during "depend" phase
- unset_colors
-else
- case "${NOCOLOR:-false}" in
- yes|true)
- unset_colors
- ;;
- no|false)
- set_colors
- ;;
- esac
-fi
+case "${NOCOLOR:-false}" in
+ yes|true)
+ unset_colors
+ ;;
+ no|false)
+ set_colors
+ ;;
+esac
if [[ -z ${USERLAND} ]] ; then
case $(uname -s) in