diff options
author | infirit <[email protected]> | 2014-01-03 15:00:52 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-01-03 15:00:52 +0100 |
commit | 4c625cd5209062aaba6eecdb95b47a219ae7c746 (patch) | |
tree | ec2e17bc4fab6c61078944a760ef4cfef4b31f14 | |
parent | 5ab654b317e170e4c7e7b814d0551a646d7111d3 (diff) | |
download | mate-common-4c625cd5209062aaba6eecdb95b47a219ae7c746.tar.bz2 mate-common-4c625cd5209062aaba6eecdb95b47a219ae7c746.tar.xz |
mate-autogen: Don't print terminal codes if stdin isn't a tty
Otherwise this shows up as garbage in log files.
Based on GNOME commit:
https://git.gnome.org/browse/gnome-common/commit/?id=7f977b0214623142819c8b7a08839949fb9f3ec0
-rw-r--r-- | macros/mate-autogen | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/macros/mate-autogen b/macros/mate-autogen index 6907f6e..de3ddb6 100644 --- a/macros/mate-autogen +++ b/macros/mate-autogen @@ -51,8 +51,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 "$@" |