version 1.6, 2012/07/10 11:53:01 |
version 1.7, 2012/07/11 07:10:15 |
|
|
* Respawn a pane (restart the command). Kill existing if -k given. |
* Respawn a pane (restart the command). Kill existing if -k given. |
*/ |
*/ |
|
|
int cmd_respawn_pane_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_ctx *); |
|
|
const struct cmd_entry cmd_respawn_pane_entry = { |
const struct cmd_entry cmd_respawn_pane_entry = { |
"respawn-pane", "respawnp", |
"respawn-pane", "respawnp", |
|
|
cmd_respawn_pane_exec |
cmd_respawn_pane_exec |
}; |
}; |
|
|
int |
enum cmd_retval |
cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
|
|
u_int idx; |
u_int idx; |
|
|
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) |
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) |
return (-1); |
return (CMD_RETURN_ERROR); |
w = wl->window; |
w = wl->window; |
|
|
if (!args_has(self->args, 'k') && wp->fd != -1) { |
if (!args_has(self->args, 'k') && wp->fd != -1) { |
|
|
fatalx("index not found"); |
fatalx("index not found"); |
ctx->error(ctx, "pane still active: %s:%u.%u", |
ctx->error(ctx, "pane still active: %s:%u.%u", |
s->name, wl->idx, idx); |
s->name, wl->idx, idx); |
return (-1); |
return (CMD_RETURN_ERROR); |
} |
} |
|
|
environ_init(&env); |
environ_init(&env); |
|
|
ctx->error(ctx, "respawn pane failed: %s", cause); |
ctx->error(ctx, "respawn pane failed: %s", cause); |
free(cause); |
free(cause); |
environ_free(&env); |
environ_free(&env); |
return (-1); |
return (CMD_RETURN_ERROR); |
} |
} |
wp->flags |= PANE_REDRAW; |
wp->flags |= PANE_REDRAW; |
server_status_window(w); |
server_status_window(w); |
|
|
environ_free(&env); |
environ_free(&env); |
return (0); |
return (CMD_RETURN_NORMAL); |
} |
} |