gnome-autogen.sh: Don't print terminal codes if stdin isn't a tty 3.1.0
authorColin Walters <walters@verbum.org>
Wed, 22 Jun 2011 19:53:42 +0000 (15:53 -0400)
committerColin Walters <walters@verbum.org>
Wed, 22 Jun 2011 19:53:42 +0000 (15:53 -0400)
Otherwise this shows up as garbage in log files.

macros2/gnome-autogen.sh

index ead647a..9967f89 100644 (file)
@@ -36,8 +36,13 @@ case `echo -n x` in
 esac
 
 # some terminal codes ...
-boldface="`tput bold 2>/dev/null`"
-normal="`tput sgr0 2>/dev/null`"
+if tty < /dev/null 1>/dev/null 2>&1; then
+    boldface="`tput bold 2>/dev/null`"
+    normal="`tput sgr0 2>/dev/null`"
+else
+    boldface=
+    normal=
+fi
 printbold() {
     echo $ECHO_N "$boldface" $ECHO_C
     echo "$@"