[gnome-common] gnome-autogen.sh: Don't print terminal codes if stdin isn't a tty



commit 7f977b0214623142819c8b7a08839949fb9f3ec0
Author: Colin Walters <walters verbum org>
Date:   Wed Jun 22 15:53:42 2011 -0400

    gnome-autogen.sh: Don't print terminal codes if stdin isn't a tty
    
    Otherwise this shows up as garbage in log files.

 macros2/gnome-autogen.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/macros2/gnome-autogen.sh b/macros2/gnome-autogen.sh
index ead647a..9967f89 100644
--- a/macros2/gnome-autogen.sh
+++ b/macros2/gnome-autogen.sh
@@ -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 "$@"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]