version 1.48, 2019/08/01 08:42:34 |
version 1.49, 2019/12/12 11:39:56 |
|
|
cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item) |
cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c; |
struct client *c = item->client; |
struct window_pane *wp = item->target.wp; |
struct window_pane *wp = item->target.wp; |
char *buf, *cause; |
char *buf, *cause; |
const char *bufname; |
const char *bufname; |
|
|
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
|
if (args_has(args, 'p')) { |
if (args_has(args, 'p')) { |
c = item->client; |
if (!file_can_print(c)) { |
if (c == NULL || |
cmdq_error(item, "can't write output to client"); |
(c->session != NULL && !(c->flags & CLIENT_CONTROL))) { |
|
cmdq_error(item, "can't write to stdout"); |
|
free(buf); |
free(buf); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
evbuffer_add(c->stdout_data, buf, len); |
file_print_buffer(c, buf, len); |
free(buf); |
|
if (args_has(args, 'P') && len > 0) |
if (args_has(args, 'P') && len > 0) |
evbuffer_add(c->stdout_data, "\n", 1); |
file_print(c, "\n"); |
server_client_push_stdout(c); |
free(buf); |
} else { |
} else { |
bufname = NULL; |
bufname = NULL; |
if (args_has(args, 'b')) |
if (args_has(args, 'b')) |