From 89fec31893bd71292de5ab88cd73816148165b2f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Aug 2015 10:07:21 +0200 Subject: [PATCH] machinectl: pass $TERM into "machinectl shell" sessions --- src/machine/machinectl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index f9f49ee892..926035d185 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -1309,6 +1309,17 @@ static int shell_machine(int argc, char *argv[], void *userdata) { return -EOPNOTSUPP; } + /* Pass $TERM to shell session, if not explicitly specified. */ + if (!strv_find_prefix(arg_setenv, "TERM=")) { + const char *t; + + t = strv_find_prefix(environ, "TERM="); + if (t) { + if (strv_extend(&arg_setenv, t) < 0) + return log_oom(); + } + } + polkit_agent_open_if_enabled(); r = sd_event_default(&event);