From 27e33ae85e5740bd6afbcfb85e870137ce4a0f80 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sat, 9 May 2026 10:16:03 -0700 Subject: [PATCH] fix: suppress ANSI colors when stdout is not a terminal Color variables set to empty strings when stdout is not a tty, preventing escape codes from being interpreted as commands by background task runners --- manage.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manage.sh b/manage.sh index bc34da6..4dea383 100755 --- a/manage.sh +++ b/manage.sh @@ -3,7 +3,12 @@ # Usage: ./manage.sh [args] set -euo pipefail -RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; NC='\033[0m' +# Only emit color codes when stdout is a real terminal +if [[ -t 1 ]]; then + RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; NC='\033[0m' +else + RED=''; GREEN=''; YELLOW=''; BLUE=''; NC='' +fi info() { echo -e "${BLUE}[turnstone]${NC} $*"; } success() { echo -e "${GREEN}[turnstone]${NC} $*"; } warn() { echo -e "${YELLOW}[turnstone]${NC} $*"; }