summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-24 09:27:19 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-24 09:27:19 +0000
commitbb8457b166635bc8d069012bb33d94e44178bfdc (patch)
treefb327f1e877f6663043d8b8bb66b0513cb2146cb /cmd-split-window.c
parent3eae71b5b28cf591f6cff652e2f2c67be394c040 (diff)
Fix error reporting for client commands by adding a flag to
cmd_find_client to tell it whether or not to show errors, sometimes it's needed and sometimes not.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index d225ce23..b9eb92e3 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -59,8 +59,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct window *w;
struct window_pane *wp, *new_wp = NULL;
struct environ env;
- const char *cmd, *cwd, *shell;
- char *cause, *new_cause;
+ const char *cmd, *cwd, *shell, *prefix;
+ char *cause, *new_cause, *cmd1;
u_int hlimit;
int size, percentage;
enum layout_type type;
@@ -122,9 +122,18 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
goto error;
}
new_wp = window_add_pane(w, hlimit);
- if (window_pane_spawn(
- new_wp, cmd, shell, cwd, &env, s->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(new_wp, cmd1, shell, cwd, &env, s->tio,
+ &cause) != 0) {
+ free(cmd1);
goto error;
+ }
+ free(cmd1);
layout_assign_pane(lc, new_wp);
server_redraw_window(w);
@@ -143,7 +152,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
template = SPLIT_WINDOW_TEMPLATE;
ft = format_create();
- if ((c = cmd_find_client(ctx, NULL)) != NULL)
+ if ((c = cmd_find_client(ctx, NULL, 1)) != NULL)
format_client(ft, c);
format_session(ft, s);
format_winlink(ft, s, wl);