Only output colour escapes when attached to a tty

This commit is contained in:
Adam Harrison committed 2015-04-28 11:35:08 +01:00
1 parent 840a493e62
commit 19fce2aa8c
1 file changed
+2 -2
+2 -2
View File
@@ -36,12 +36,12 @@ remote() {
}
colourise() {
echo -ne '\e['$1'm'
[ -t 0 ] && echo -ne '\e['$1'm' || true
shift
# It's important that we don't do this in a subshell, as some
# commands we execute need to modify global state
"$@"
echo -ne '\e[0m'
[ -t 0 ] && echo -ne '\e[0m' || true
}
whitely() {