diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-12-18 14:13:30 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-12-18 14:13:30 -0800 |
commit | af7d4ecf7e939818df2f2a210a376d91dd41291d (patch) | |
tree | d1e98dc2477982433d877bb76a97d3dfa1593089 | |
parent | 4c91ad25d42202f66930853295eddcabea34fb8f (diff) | |
download | portage-af7d4ecf7e939818df2f2a210a376d91dd41291d.tar.gz portage-af7d4ecf7e939818df2f2a210a376d91dd41291d.tar.bz2 portage-af7d4ecf7e939818df2f2a210a376d91dd41291d.zip |
set_colors(): suppress "/dev/tty: No such device"
-rw-r--r-- | bin/isolated-functions.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 1bcc5c907..9321ad598 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -413,9 +413,11 @@ set_colors() { COLS=${COLUMNS:-0} # bash's internal COLUMNS variable # Avoid wasteful stty calls during the "depend" phases. # If stdout is a pipe, the parent process can export COLUMNS - # if it's relevant. + # if it's relevant. Use an extra subshell for stty calls, in + # order to redirect "/dev/tty: No such device or address" + # error from bash to /dev/null. [[ $COLS == 0 && $EBUILD_PHASE != depend ]] && \ - COLS=$(set -- $(stty size </dev/tty 2>/dev/null) ; echo $2) + COLS=$(set -- $( ( stty size </dev/tty ) 2>/dev/null || echo 24 80 ) ; echo $2) (( COLS > 0 )) || (( COLS = 80 )) # Now, ${ENDCOL} will move us to the end of the |