fix: auto-detect terminal color support instead of forcing it
FORCE_COLOR defaulted to 1, emitting ANSI codes unconditionally. On SSH sessions without a proper TTY or with TERM=dumb this caused color codes to render text invisible. Now colors are enabled only when stdout is an interactive terminal; FORCE_COLOR=1 can still override when needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -16,8 +16,12 @@ WHIP_CONFIG="${WHIP_CONFIG:-arty.yml}"
|
||||
WHIP_HOOKS_DIR=".whip/hooks"
|
||||
WHIP_CHANGELOG="${WHIP_CHANGELOG:-CHANGELOG.md}"
|
||||
|
||||
# Colors for output - only use colors if output is to a terminal or if FORCE_COLOR is set
|
||||
# Enable colors only when stdout is a real terminal (or FORCE_COLOR=1 overrides)
|
||||
if [[ -t 1 && "${TERM:-}" != "dumb" ]]; then
|
||||
export FORCE_COLOR=${FORCE_COLOR:-"1"}
|
||||
else
|
||||
export FORCE_COLOR=${FORCE_COLOR:-"0"}
|
||||
fi
|
||||
if [[ "$FORCE_COLOR" = "0" ]]; then
|
||||
export RED=''
|
||||
export GREEN=''
|
||||
|
||||
Reference in New Issue
Block a user