summaryrefslogtreecommitdiff
path: root/src/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-15 23:49:02 +0100
committerLennart Poettering <lennart@poettering.net>2010-11-15 23:49:02 +0100
commite3aa71c38cbecb24e6333411ee19814796a5b1d0 (patch)
tree5ae80b4fcbf3bc4f93e3905cecab2fc40f1cb1da /src/execute.c
parent96a8cbfae1b37cf0a9c0591bfef93f9de1561bc4 (diff)
exec: automatically determine right TERM= setting based on tty name
Diffstat (limited to 'src/execute.c')
-rw-r--r--src/execute.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/execute.c b/src/execute.c
index 48e55ea4c2..05abd5aaac 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1252,7 +1252,7 @@ int exec_spawn(ExecCommand *command,
}
}
- if (!(our_env = new0(char*, 6))) {
+ if (!(our_env = new0(char*, 7))) {
r = EXIT_MEMORY;
goto fail;
}
@@ -1277,7 +1277,15 @@ int exec_spawn(ExecCommand *command,
goto fail;
}
- assert(n_env <= 6);
+ if (is_terminal_input(context->std_input) ||
+ context->std_output == EXEC_OUTPUT_TTY ||
+ context->std_error == EXEC_OUTPUT_TTY)
+ if (!(our_env[n_env++] = strdup(default_term_for_tty(tty_path(context))))) {
+ r = EXIT_MEMORY;
+ goto fail;
+ }
+
+ assert(n_env <= 7);
if (!(final_env = strv_env_merge(
4,