mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-17 00:51:36 +02:00
Pass return code from _exec; allow command sequences to work from the command line.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-move-window.c,v 1.3 2008-12-10 20:25:41 nicm Exp $ */
|
||||
/* $Id: cmd-move-window.c,v 1.4 2009-01-19 18:23:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -26,7 +26,7 @@
|
||||
* Move a window.
|
||||
*/
|
||||
|
||||
void cmd_move_window_exec(struct cmd *, struct cmd_ctx *);
|
||||
int cmd_move_window_exec(struct cmd *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_move_window_entry = {
|
||||
"move-window", "movew",
|
||||
@ -41,7 +41,7 @@ const struct cmd_entry cmd_move_window_entry = {
|
||||
cmd_srcdst_print
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_srcdst_data *data = self->data;
|
||||
@ -52,11 +52,11 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
int destroyed, idx;
|
||||
|
||||
if ((wl_src = cmd_find_window(ctx, data->src, &src)) == NULL)
|
||||
return;
|
||||
return (-1);
|
||||
|
||||
if (arg_parse_window(data->dst, &dst, &idx) != 0) {
|
||||
ctx->error(ctx, "bad window: %s", data->dst);
|
||||
return;
|
||||
return (-1);
|
||||
}
|
||||
if (dst == NULL)
|
||||
dst = ctx->cursession;
|
||||
@ -64,7 +64,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
dst = cmd_current_session(ctx);
|
||||
if (dst == NULL) {
|
||||
ctx->error(ctx, "session not found: %s", data->dst);
|
||||
return;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
wl_dst = NULL;
|
||||
@ -72,7 +72,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
wl_dst = winlink_find_by_index(&dst->windows, idx);
|
||||
if (wl_dst != NULL) {
|
||||
if (wl_dst->window == wl_src->window)
|
||||
goto out;
|
||||
return (0);
|
||||
|
||||
if (data->flags & CMD_KFLAG) {
|
||||
/*
|
||||
@ -94,7 +94,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
wl_dst = session_attach(dst, wl_src->window, idx);
|
||||
if (wl_dst == NULL) {
|
||||
ctx->error(ctx, "index in use: %d", idx);
|
||||
return;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
destroyed = session_detach(src, wl_src);
|
||||
@ -117,7 +117,5 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
}
|
||||
recalculate_sizes();
|
||||
|
||||
out:
|
||||
if (ctx->cmdclient != NULL)
|
||||
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
|
||||
return (0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user