From 5e01021cba920448a2ff04220806e366f628e14c Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Wed, 22 Apr 2015 15:00:41 +0100 Subject: [PATCH] Avoid use of subshell in whitely/greyly --- test/config.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/config.sh b/test/config.sh index f1db670d..432a0a54 100644 --- a/test/config.sh +++ b/test/config.sh @@ -35,12 +35,21 @@ remote() { $@ > >(while read line; do echo -e "\e[0;34m$rem>\e[0m $line"; done) } +colourise() { + echo -ne '\e['$1'm' + 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' +} + whitely() { - echo -e '\e[1;37m'`$@`'\e[0m' + colourise '1;37' "$@" } greyly () { - echo -e '\e[0;37m'`$@`'\e[0m' + colourise '0;37' "$@" } run_on() {