From 8aa1e7c81e4b8b8d3da0c5a9a43e4c89643b6d44 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 22 Aug 2025 07:38:09 -0600 Subject: [PATCH] cli: Avoid sending ANSI characters to a non-terminal Detect if there is no terminal present (this only works on sandbox) and skip sending ANSI characters when the CLI starts up. This avoids having them in logs, for example. Signed-off-by: Simon Glass --- common/cli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/cli.c b/common/cli.c index 4694a35cd0e..23988330dd8 100644 --- a/common/cli.c +++ b/common/cli.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -337,6 +338,6 @@ void cli_init(void) hush_init_var(); #endif - if (CONFIG_IS_ENABLED(VIDEO_ANSI)) + if (CONFIG_IS_ENABLED(VIDEO_ANSI) && serial_is_tty()) printf(ANSI_CURSOR_SHOW "\n"); }