aboutsummaryrefslogtreecommitdiff
path: root/cmd-attach-session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-09 17:48:55 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-09 17:48:55 +0000
commit29b1b2fb5eee4319cdc1464ee377b68f3171dc27 (patch)
tree724627190ad66e119ec2771c5731e720a70ea3e9 /cmd-attach-session.c
parentaf3db9a4fea9c436ff8e6f452a538ba295e1e6fe (diff)
downloadrtmux-29b1b2fb5eee4319cdc1464ee377b68f3171dc27.tar.gz
rtmux-29b1b2fb5eee4319cdc1464ee377b68f3171dc27.tar.bz2
rtmux-29b1b2fb5eee4319cdc1464ee377b68f3171dc27.zip
Sync OpenBSD patchset 231:
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 session 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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index d39cdeff..d83e4c58 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.31 2009-08-09 15:26:24 tcunha Exp $ */
+/* $Id: cmd-attach-session.c,v 1.32 2009-08-09 17:48:55 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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();