nspawn: set TERM to "dumb" if we are invoked outside of TTY context

This commit is contained in:
Lennart Poettering
2025-02-27 15:13:15 +01:00
parent 4d6eb6441a
commit ddb503b7f6
+3 -3
View File
@@ -3582,9 +3582,9 @@ static int inner_child(
/* LXC sets container=lxc, so follow the scheme here */
envp[n_env++] = strjoina("container=", arg_container_service_name);
envp[n_env] = strv_find_prefix(environ, "TERM=");
if (envp[n_env])
n_env++;
/* Propagate $TERM unless we are invoked in pipe mode and stdin/stdout/stderr don't refer to a TTY */
const char *term = (arg_console_mode != CONSOLE_PIPE || on_tty()) ? strv_find_prefix(environ, "TERM=") : NULL;
envp[n_env++] = (char*) (term ?: "TERM=dumb");
if (home || !uid_is_valid(arg_uid) || arg_uid == 0)
if (asprintf(envp + n_env++, "HOME=%s", home ?: "/root") < 0)