diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-22 16:25:50 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-22 16:25:50 +0000 |
commit | ce7bf1083edd5679420d5288ae53a52759e0d51c (patch) | |
tree | b374f41806da66441a5ca5b69eba0f683e6b2f17 /window.c | |
parent | 1db4ec6e6327aa4b879e42f5e37a2c599f487206 (diff) | |
parent | 1c82cf76608d7e87d734414ddba6e76622b9646c (diff) | |
download | rtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.tar.gz rtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.tar.bz2 rtmux-ce7bf1083edd5679420d5288ae53a52759e0d51c.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -307,24 +307,36 @@ window_create1(u_int sx, u_int sy) struct window * window_create(const char *name, const char *cmd, const char *shell, const char *cwd, struct environ *env, struct termios *tio, - u_int sx, u_int sy, u_int hlimit,char **cause) + u_int sx, u_int sy, u_int hlimit, char **cause) { struct window *w; struct window_pane *wp; + const char *prefix; + char *cmd1; w = window_create1(sx, sy); wp = window_add_pane(w, hlimit); layout_init(w); - if (window_pane_spawn(wp, cmd, shell, cwd, env, tio, cause) != 0) { + + if (*cmd != '\0') { + prefix = options_get_string(&w->options, "command-prefix"); + xasprintf(&cmd1, "%s%s", prefix, cmd); + } else + cmd1 = xstrdup(""); + if (window_pane_spawn(wp, cmd1, shell, cwd, env, tio, cause) != 0) { window_destroy(w); + free(cmd1); return (NULL); } + free(cmd1); + w->active = TAILQ_FIRST(&w->panes); if (name != NULL) { w->name = xstrdup(name); options_set_number(&w->options, "automatic-rename", 0); } else w->name = default_window_name(w); + return (w); } @@ -701,6 +713,8 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, wp->cwd = xstrdup(cwd); } + log_debug("spawn: %s -- %s", wp->shell, wp->cmd); + memset(&ws, 0, sizeof ws); ws.ws_col = screen_size_x(&wp->base); ws.ws_row = screen_size_y(&wp->base); |