summaryrefslogtreecommitdiffstats
path: root/cmd-respawn-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
commit93230a64bc9369c726cc68d3f539b3bf66cff069 (patch)
tree0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-respawn-window.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-respawn-window.c')
-rw-r--r--cmd-respawn-window.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index a89a8f0a..deccb6f8 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-respawn-window.c,v 1.11 2009-01-14 22:16:57 nicm Exp $ */
+/* $Id: cmd-respawn-window.c,v 1.12 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -26,7 +26,7 @@
* Respawn a window (restart the command). Kill existing if -k given.
*/
-void cmd_respawn_window_exec(struct cmd *, struct cmd_ctx *);
+int cmd_respawn_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_respawn_window_entry = {
"respawn-window", "respawnw",
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
cmd_target_print
};
-void
+int
cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
@@ -54,7 +54,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
u_int i;
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
- return;
+ return (-1);
w = wl->window;
if (!(data->flags & CMD_KFLAG)) {
@@ -63,7 +63,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
continue;
ctx->error(ctx,
"window still active: %s:%d", s->name, wl->idx);
- return;
+ return (-1);
}
}
@@ -79,13 +79,12 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
window_pane_resize(wp, w->sx, w->sy);
if (window_pane_spawn(wp, data->arg, NULL, env) != 0) {
ctx->error(ctx, "respawn failed: %s:%d", s->name, wl->idx);
- return;
+ return (-1);
}
screen_reinit(&wp->base);
recalculate_sizes();
server_redraw_window(w);
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}