From 8ffebaaf4d25ad72df47d1418f01b27b8321811f Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 28 May 2025 20:40:33 +0200 Subject: [PATCH] core/exec-invoke: propagate $COLORTERM and $NO_COLOR from pid1 as well Follow-up for 19aff5f775386a34224f710b88457c1e6bdf0e2f --- src/core/exec-invoke.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index bfa21474e17..2e96bf2eb72 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -4548,6 +4548,16 @@ static int setup_term_environment(const ExecContext *context, char ***env) { if (r < 0) return r; + FOREACH_STRING(i, "COLORTERM=", "NO_COLOR=") { + const char *s = strv_find_prefix(environ, i); + if (!s) + continue; + + r = strv_env_replace_strdup(env, s); + if (r < 0) + return r; + } + return 1; } } -- 2.47.3