summaryrefslogtreecommitdiffstats
path: root/cmd-respawn-window.c
diff options
context:
space:
mode:
authornicm <nicm>2017-03-09 17:02:38 +0000
committernicm <nicm>2017-03-09 17:02:38 +0000
commitdbfee6a468172899759a86c7bf50169053adce45 (patch)
tree6db1e79cc83501839bb96436a430cce03c1ea730 /cmd-respawn-window.c
parente8f2609ca445b09b04cb131059e5b71c3a40f451 (diff)
Move server_fill_environ into environ.c and move some other common code
into it.
Diffstat (limited to 'cmd-respawn-window.c')
-rw-r--r--cmd-respawn-window.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 92ba6299..876fab6a 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -66,11 +66,6 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
}
}
- env = environ_create();
- environ_copy(global_environ, env);
- environ_copy(s->environ, env);
- server_fill_environ(s, env);
-
wp = TAILQ_FIRST(&w->panes);
TAILQ_REMOVE(&w->panes, wp, entry);
layout_free(w);
@@ -86,6 +81,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
if (envent != NULL)
path = envent->value;
+ env = environ_for_session(s);
if (window_pane_spawn(wp, args->argc, args->argv, path, NULL, NULL, env,
s->tio, &cause) != 0) {
cmdq_error(item, "respawn window failed: %s", cause);
@@ -94,6 +90,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
server_destroy_pane(wp, 0);
return (CMD_RETURN_ERROR);
}
+ environ_free(env);
layout_init(w, wp);
window_pane_reset_mode(wp);
screen_reinit(&wp->base);
@@ -103,6 +100,5 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
recalculate_sizes();
server_redraw_window(w);
- environ_free(env);
return (CMD_RETURN_NORMAL);
}