summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-12-09 16:28:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-12-09 16:28:18 +0000
commitf308ba93aae9de462b1b46e68b47bd77a843eed6 (patch)
tree82ecdeedd7bf7c532a161cb0d79328ff5de85cb0 /cmd-split-window.c
parente04d13f6a6591351b1184e7801604137f6a72b1d (diff)
Change the way the working directory for new processes is discovered. If
default-path isn't empty, it is used. Otherwise: 1) If tmux neww is run from the command line, the working directory of the client is used. 2) Otherwise sysctl KERN_PROC_CWD is used to retrieve the current working directory of the process in the active pane. 3) If that fails, the directory where the session was created is used. Support code by Romain Francois, OpenBSD specific bits by me. Note this requires a recent userland and kernel with KERN_PROC_CWD.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index b1b738b1..7184d964 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -78,13 +78,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
cmd = options_get_string(&s->options, "default-command");
else
cmd = args->argv[0];
- cwd = options_get_string(&s->options, "default-path");
- if (*cwd == '\0') {
- if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
- cwd = ctx->cmdclient->cwd;
- else
- cwd = s->cwd;
- }
+ cwd = cmd_get_default_path(ctx);
type = LAYOUT_TOPBOTTOM;
if (args_has(args, 'h'))