mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 17:24:22 +01:00
Mark control commands specially so the client can identify them, based
on a diff from George Nachman a while back.
This commit is contained in:
parent
1099442c0a
commit
a0172a6ae5
@ -157,14 +157,17 @@ int
|
||||
cmdq_guard(struct cmd_q *cmdq, const char *guard)
|
||||
{
|
||||
struct client *c = cmdq->client;
|
||||
int flags;
|
||||
|
||||
if (c == NULL)
|
||||
return 0;
|
||||
if (!(c->flags & CLIENT_CONTROL))
|
||||
return 0;
|
||||
|
||||
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u\n", guard,
|
||||
(long) cmdq->time, cmdq->number);
|
||||
flags = !!(cmdq->cmd->flags & CMD_CONTROL);
|
||||
|
||||
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
|
||||
(long) cmdq->time, cmdq->number, flags);
|
||||
server_push_stdout(c);
|
||||
return 1;
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ control_callback(struct client *c, int closed, unused void *data)
|
||||
{
|
||||
char *line, *cause;
|
||||
struct cmd_list *cmdlist;
|
||||
struct cmd *cmd;
|
||||
|
||||
if (closed)
|
||||
c->flags |= CLIENT_EXIT;
|
||||
@ -78,6 +79,8 @@ control_callback(struct client *c, int closed, unused void *data)
|
||||
|
||||
free(cause);
|
||||
} else {
|
||||
TAILQ_FOREACH(cmd, &cmdlist->list, qentry)
|
||||
cmd->flags |= CMD_CONTROL;
|
||||
cmdq_run(c->cmdq, cmdlist);
|
||||
cmd_list_free(cmdlist);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user