nspawn: set TERM to "dumb" if we are invoked outside of TTY context
This commit is contained in:
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user