From 92366b8fbc2de5c72ad6ee801f4b32a1aa6b36e1 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 11 Aug 2025 16:35:02 +0900 Subject: [PATCH] nspawn: always set TERM=dumb when running with a pipe Otherwise, we will get unexpected OSC sequences. --- src/nspawn/nspawn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 8013aa94c3..22bbdc1132 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3551,7 +3551,7 @@ static int inner_child( envp[n_env++] = strjoina("container=", arg_container_service_name); /* Propagate $TERM & Co. unless we are invoked in pipe mode and stdin/stdout/stderr don't refer to a TTY */ - if (arg_console_mode != CONSOLE_PIPE || on_tty()) { + if (arg_console_mode != CONSOLE_PIPE && !terminal_is_dumb()) FOREACH_STRING(v, "TERM=", "COLORTERM=", "NO_COLOR=") { char *t = strv_find_prefix(environ, v); if (!t) @@ -3559,7 +3559,7 @@ static int inner_child( envp[n_env++] = t; } - } else + else envp[n_env++] = (char*) "TERM=dumb"; if (home || !uid_is_valid(arg_uid) || arg_uid == 0)