summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authornicm <nicm>2015-06-07 21:39:39 +0000
committernicm <nicm>2015-06-07 21:39:39 +0000
commitc4e811e51936edab66803a7b9e099ac135e6e19b (patch)
tree8f2d0eb57df2cfc54dc608cf21c133750cfab494 /cmd-new-session.c
parented6c036ee3192029e9d0a60e8f9bb2a4ccfb99bf (diff)
Add -E flag when attaching or switching client to bypass
update-environment, from Steven Lu.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 0fb849e2..1533e5f0 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -37,8 +37,8 @@ enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = {
"new-session", "new",
- "Ac:dDF:n:Ps:t:x:y:", 0, -1,
- "[-AdDP] [-c start-directory] [-F format] [-n window-name] "
+ "Ac:dDEF:n:Ps:t:x:y:", 0, -1,
+ "[-AdDEP] [-c start-directory] [-F format] [-n window-name] "
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
"[-y height] [command]",
CMD_STARTSERVER,
@@ -91,7 +91,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
if (session_find(newname) != NULL) {
if (args_has(args, 'A')) {
return (cmd_attach_session(cmdq, newname,
- args_has(args, 'D'), 0, NULL));
+ args_has(args, 'D'), 0, NULL,
+ args_has(args, 'E')));
}
cmdq_error(cmdq, "duplicate session: %s", newname);
return (CMD_RETURN_ERROR);
@@ -230,9 +231,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
/* Construct the environment. */
environ_init(&env);
- update = options_get_string(&global_s_options, "update-environment");
- if (c != NULL)
+ if (c != NULL && !args_has(args, 'E')) {
+ update = options_get_string(&global_s_options,
+ "update-environment");
environ_update(update, &c->environ, &env);
+ }
/* Create the new session. */
idx = -1 - options_get_number(&global_s_options, "base-index");