]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: always set TERM=dumb when running with a pipe
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Aug 2025 07:35:02 +0000 (16:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Aug 2025 14:43:52 +0000 (23:43 +0900)
Otherwise, we will get unexpected OSC sequences.

src/nspawn/nspawn.c

index 8013aa94c3e056932803c7780dfd7155f3fa2dce..22bbdc113255df15bb7f6998b8bf4b1c100c970c 100644 (file)
@@ -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)