summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authornicm <nicm>2014-04-17 13:02:59 +0000
committernicm <nicm>2014-04-17 13:02:59 +0000
commit3e27be353d045ea231259e96892ad8be273bf9ae (patch)
tree23f19f033bbc33a725465e7d8ef6e3a7987e9d7d /cmd-split-window.c
parentc3b2e5eed3b3ad4fd33cf011c5f4de6d25c602c0 (diff)
Set PATH explicitly, either from client or session
environment. Previously it came from the session environment. From J Raynor.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index a431e000..50949b39 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -61,7 +61,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
struct window *w;
struct window_pane *wp, *new_wp = NULL;
struct environ env;
- const char *cmd, *shell, *template;
+ const char *cmd, *path, *shell, *template;
char *cause, *new_cause, *cp;
u_int hlimit;
int size, percentage, cwd, fd = -1;
@@ -69,6 +69,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
struct layout_cell *lc;
struct client *c;
struct format_tree *ft;
+ struct environ_entry *envent;
if ((wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp)) == NULL)
return (CMD_RETURN_ERROR);
@@ -148,8 +149,17 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
goto error;
}
new_wp = window_add_pane(w, hlimit);
+
+ path = NULL;
+ if (cmdq->client != NULL && cmdq->client->session == NULL)
+ envent = environ_find(&cmdq->client->environ, "PATH");
+ else
+ envent = environ_find(&s->environ, "PATH");
+ if (envent != NULL)
+ path = envent->value;
+
if (window_pane_spawn(
- new_wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
+ new_wp, cmd, path, shell, cwd, &env, s->tio, &cause) != 0)
goto error;
layout_assign_pane(lc, new_wp);