diff options
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index b483cdd4..70004a14 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -149,7 +149,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct winlink *wl; struct window *w; struct window_pane *wp; - const char **env; + struct environ env; char *cmd, *cwd, *cause; u_int hlimit; int size; @@ -159,7 +159,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); w = wl->window; - env = server_fill_environ(s); + environ_init(&env); + environ_copy(&global_environ, &env); + environ_copy(&s->environ, &env); + server_fill_environ(s, &env); cmd = data->cmd; if (cmd == NULL) @@ -181,7 +184,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) type = LAYOUT_LEFTRIGHT; wp = window_add_pane(w, hlimit); - if (window_pane_spawn(wp, cmd, cwd, env, &cause) != 0) + if (window_pane_spawn(wp, cmd, cwd, &env, &cause) != 0) goto error; if (layout_split_pane(w->active, type, size, wp) != 0) { cause = xstrdup("pane too small"); @@ -197,9 +200,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) } else server_status_session(s); + environ_free(&env); return (0); error: + environ_free(&env); if (wp != NULL) window_remove_pane(w, wp); ctx->error(ctx, "create pane failed: %s", cause); |