summaryrefslogtreecommitdiffstats
path: root/cmd-new-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-10 19:37:35 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-10 19:37:35 +0000
commit4d711648263372e06928d1c495efb220c7b804d3 (patch)
treeba1fd7a3ce506332abad9d3e4101fd03b5e69b9d /cmd-new-window.c
parent88ab74ac20ad96771a9f06667da666bf85cd3f23 (diff)
Pick up cwd from environment,.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r--cmd-new-window.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c
index f730e3ac..2dad77e8 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-window.c,v 1.26 2008-12-10 20:25:41 nicm Exp $ */
+/* $Id: cmd-new-window.c,v 1.27 2009-01-10 19:37:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -115,7 +115,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct cmd_new_window_data *data = self->data;
struct session *s;
struct winlink *wl;
- char *cmd;
+ char *cmd, *cwd;
int idx;
if (data == NULL)
@@ -137,8 +137,12 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
cmd = data->cmd;
if (cmd == NULL)
cmd = options_get_string(&s->options, "default-command");
+ if (ctx->cmdclient == NULL || ctx->cmdclient->cwd == NULL)
+ cwd = options_get_string(&global_options, "default-path");
+ else
+ cwd = ctx->cmdclient->cwd;
- wl = session_new(s, data->name, cmd, idx);
+ wl = session_new(s, data->name, cmd, cwd, idx);
if (wl == NULL) {
ctx->error(ctx, "command failed: %s", cmd);
return;