Defer reading from control client until the command line command has

completed.
This commit is contained in:
nicm 2022-07-06 08:31:59 +00:00
parent dd602eaa61
commit 9e03df5500
3 changed files with 12 additions and 2 deletions

View File

@ -776,7 +776,6 @@ control_start(struct client *c)
cs->read_event = bufferevent_new(c->fd, control_read_callback, cs->read_event = bufferevent_new(c->fd, control_read_callback,
control_write_callback, control_error_callback, c); control_write_callback, control_error_callback, c);
bufferevent_enable(cs->read_event, EV_READ);
if (c->flags & CLIENT_CONTROLCONTROL) if (c->flags & CLIENT_CONTROLCONTROL)
cs->write_event = cs->read_event; cs->write_event = cs->read_event;
@ -793,6 +792,13 @@ control_start(struct client *c)
} }
} }
/* Control client ready. */
void
control_ready(struct client *c)
{
bufferevent_enable(c->control_state->read_event, EV_READ);
}
/* Discard all output for a client. */ /* Discard all output for a client. */
void void
control_discard(struct client *c) control_discard(struct client *c)

View File

@ -2791,8 +2791,11 @@ server_client_command_done(struct cmdq_item *item, __unused void *data)
if (~c->flags & CLIENT_ATTACHED) if (~c->flags & CLIENT_ATTACHED)
c->flags |= CLIENT_EXIT; c->flags |= CLIENT_EXIT;
else if (~c->flags & CLIENT_EXIT) else if (~c->flags & CLIENT_EXIT) {
if (c->flags & CLIENT_CONTROL)
control_ready(c);
tty_send_requests(&c->tty); tty_send_requests(&c->tty);
}
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }

1
tmux.h
View File

@ -3134,6 +3134,7 @@ char *parse_window_name(const char *);
/* control.c */ /* control.c */
void control_discard(struct client *); void control_discard(struct client *);
void control_start(struct client *); void control_start(struct client *);
void control_ready(struct client *);
void control_stop(struct client *); void control_stop(struct client *);
void control_set_pane_on(struct client *, struct window_pane *); void control_set_pane_on(struct client *, struct window_pane *);
void control_set_pane_off(struct client *, struct window_pane *); void control_set_pane_off(struct client *, struct window_pane *);