Set PATH explicitly, either from client or session

environment. Previously it came from the session environment. From J
Raynor.
This commit is contained in:
nicm
2014-04-17 13:02:59 +00:00
parent c3b2e5eed3
commit 3e27be353d
8 changed files with 88 additions and 30 deletions

View File

@@ -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);