aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-05-28 17:27:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-06-13 09:55:23 +0000
commit755f96321ab47f931d11680027d47d1d772f5584 (patch)
treebf35e0c7ca5b15640513b2ad3f470c29a6127267 /slave.c
parentcommands: scroll up: simplify viewport clamping logic (diff)
config: add a new ‘environment’ section
This section allows the user to define custom environment variables to be set in the child process: [environment] name=value
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/slave.c b/slave.c
index db60d7b5..6473ac7c 100644
--- a/slave.c
+++ b/slave.c
@@ -305,8 +305,9 @@ err:
pid_t
slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
- char *const *envp, const char *term_env, const char *conf_shell,
- bool login_shell, const user_notifications_t *notifications)
+ char *const *envp, const env_var_list_t *extra_env_vars,
+ const char *term_env, const char *conf_shell, bool login_shell,
+ const user_notifications_t *notifications)
{
int fork_pipe[2];
if (pipe2(fork_pipe, O_CLOEXEC) < 0) {
@@ -356,6 +357,11 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
setenv("TERMINFO", FOOT_TERMINFO_PATH, 1);
#endif
+ if (extra_env_vars != NULL) {
+ tll_foreach(*extra_env_vars, it)
+ setenv(it->item.name, it->item.value, 1);
+ }
+
char **_shell_argv = NULL;
char **shell_argv = NULL;