From: Zac Medico Date: Sun, 18 Dec 2011 22:13:30 +0000 (-0800) Subject: set_colors(): suppress "/dev/tty: No such device" X-Git-Tag: v2.2.0_alpha82~38 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af7d4ecf7e939818df2f2a210a376d91dd41291d;p=portage.git set_colors(): suppress "/dev/tty: No such device" --- 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/null) ; echo $2) + COLS=$(set -- $( ( stty size /dev/null || echo 24 80 ) ; echo $2) (( COLS > 0 )) || (( COLS = 80 )) # Now, ${ENDCOL} will move us to the end of the