summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-03-09 18:01:16 +0000
committerThomas Adam <thomas@xteddy.org>2017-03-09 18:01:16 +0000
commitc5bdae466e4dad6c185fa5146b11275b6119ff24 (patch)
tree05536631ebb8c314a3026748c2b20753594cc5af /cmd-split-window.c
parentfd96ccfd802aec27a4835f7bb2030003b9668e64 (diff)
parentbce1dee0341b3624d927d393fd0f21771660d5ed (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index cbd5e0b2..7724b9ab 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -70,11 +70,6 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
server_unzoom_window(w);
- env = environ_create();
- environ_copy(global_environ, env);
- environ_copy(s->environ, env);
- server_fill_environ(s, env);
-
if (args->argc == 0) {
cmd = options_get_string(s->options, "default-command");
if (cmd != NULL && *cmd != '\0') {
@@ -147,9 +142,13 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
if (envent != NULL)
path = envent->value;
+ env = environ_for_session(s);
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, env,
- s->tio, &cause) != 0)
+ s->tio, &cause) != 0) {
+ environ_free(env);
goto error;
+ }
+ environ_free(env);
server_redraw_window(w);
@@ -160,8 +159,6 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
} else
server_status_session(s);
- environ_free(env);
-
if (args_has(args, 'P')) {
if ((template = args_get(args, 'F')) == NULL)
template = SPLIT_WINDOW_TEMPLATE;
@@ -185,7 +182,6 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
error:
- environ_free(env);
if (new_wp != NULL) {
layout_close_pane(new_wp);
window_remove_pane(w, new_wp);