diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-08 21:52:43 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-08 21:52:43 +0000 |
commit | 6491274f60c175b89b02b6e4cd0c59b13717e2ec (patch) | |
tree | 615959fa3459ad20491f0fedcfcce5a2940d0186 /cmd-respawn-window.c | |
parent | e9856294408c76f374547d9e74d4292f1b0c1163 (diff) | |
download | rtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.tar.gz rtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.tar.bz2 rtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.zip |
Infrastructure and commands to manage the environment for processes started
within tmux.
There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.
New commands set-environment and show-environment manipulate or display the
environments.
A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
Diffstat (limited to 'cmd-respawn-window.c')
-rw-r--r-- | cmd-respawn-window.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index 70573929..735c637b 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -47,7 +47,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct window *w; struct window_pane *wp; struct session *s; - const char **env; + struct environ env; char *cause; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) @@ -64,7 +64,10 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) } } - env = server_fill_environ(s); + environ_init(&env); + environ_copy(&global_environ, &env); + environ_copy(&s->environ, &env); + server_fill_environ(s, &env); wp = TAILQ_FIRST(&w->panes); TAILQ_REMOVE(&w->panes, wp, entry); @@ -72,9 +75,10 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) window_destroy_panes(w); TAILQ_INSERT_HEAD(&w->panes, wp, entry); window_pane_resize(wp, w->sx, w->sy); - if (window_pane_spawn(wp, data->arg, NULL, env, &cause) != 0) { + if (window_pane_spawn(wp, data->arg, NULL, &env, &cause) != 0) { ctx->error(ctx, "respawn window failed: %s", cause); xfree(cause); + environ_free(&env); return (-1); } layout_init(w); @@ -84,5 +88,6 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) recalculate_sizes(); server_redraw_window(w); + environ_free(&env); return (0); } |