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-attach-session.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-attach-session.c')
-rw-r--r-- | cmd-attach-session.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 4604ee27..92be3085 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -29,7 +29,7 @@ int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_attach_session_entry = { "attach-session", "attach", "[-d] " CMD_TARGET_SESSION_USAGE, - CMD_CANTNEST|CMD_STARTSERVER, CMD_CHFLAG('d'), + CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, CMD_CHFLAG('d'), cmd_target_init, cmd_target_parse, cmd_attach_session_exec, @@ -43,6 +43,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct session *s; struct client *c; + const char *update; char *overrides, *cause; u_int i; @@ -93,6 +94,10 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->cmdclient->session = s; server_write_client(ctx->cmdclient, MSG_READY, NULL, 0); + + update = options_get_string(&s->options, "update-environment"); + environ_update(update, &ctx->cmdclient->environ, &s->environ); + server_redraw_client(ctx->cmdclient); } recalculate_sizes(); |