diff options
author | Thomas Adam <thomas@xteddy.org> | 2014-04-23 11:26:11 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2014-04-23 11:26:11 +0100 |
commit | 953c3ef47a1933d38308075c1bacc7ea8d38301b (patch) | |
tree | 6484bdd51ecedbb5888717db271c151257ec87f5 /cmd-new-session.c | |
parent | 12e9c974fadc5ed6f0e7db10c40d5a0d55e0da8a (diff) | |
parent | 64613b9d411a7c76a50a2f9c66df345f082fce25 (diff) | |
download | rtmux-953c3ef47a1933d38308075c1bacc7ea8d38301b.tar.gz rtmux-953c3ef47a1933d38308075c1bacc7ea8d38301b.tar.bz2 rtmux-953c3ef47a1933d38308075c1bacc7ea8d38301b.zip |
Merge branch 'obsd-master'
Conflicts:
Makefile
tmux.1
window.c
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index c190e972..3071bd64 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -20,7 +20,6 @@ #include <errno.h> #include <fcntl.h> -#include <pwd.h> #include <stdlib.h> #include <string.h> #include <termios.h> @@ -55,10 +54,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) struct environ env; struct termios tio, *tiop; const char *newname, *target, *update, *errstr, *template; + const char *path; char *cmd, *cause, *cp; int detached, already_attached, idx, cwd, fd = -1; u_int sx, sy; struct format_tree *ft; + struct environ_entry *envent; if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) { cmdq_error(cmdq, "command or window name given with target"); @@ -189,6 +190,14 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) else cmd = options_get_string(&global_s_options, "default-command"); + path = NULL; + if (c != NULL && c->session == NULL) + envent = environ_find(&c->environ, "PATH"); + else + envent = environ_find(&global_environ, "PATH"); + if (envent != NULL) + path = envent->value; + /* Construct the environment. */ environ_init(&env); update = options_get_string(&global_s_options, "update-environment"); @@ -197,7 +206,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) /* Create the new session. */ idx = -1 - options_get_number(&global_s_options, "base-index"); - s = session_create(newname, cmd, cwd, &env, tiop, idx, sx, sy, &cause); + s = session_create(newname, cmd, path, cwd, &env, tiop, idx, sx, sy, + &cause); if (s == NULL) { cmdq_error(cmdq, "create session failed: %s", cause); free(cause); |