mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-09 01:35:20 +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)
|
cmdq_guard(struct cmd_q *cmdq, const char *guard)
|
||||||
{
|
{
|
||||||
struct client *c = cmdq->client;
|
struct client *c = cmdq->client;
|
||||||
|
int flags;
|
||||||
|
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (!(c->flags & CLIENT_CONTROL))
|
if (!(c->flags & CLIENT_CONTROL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u\n", guard,
|
flags = !!(cmdq->cmd->flags & CMD_CONTROL);
|
||||||
(long) cmdq->time, cmdq->number);
|
|
||||||
|
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
|
||||||
|
(long) cmdq->time, cmdq->number, flags);
|
||||||
server_push_stdout(c);
|
server_push_stdout(c);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ control_callback(struct client *c, int closed, unused void *data)
|
|||||||
{
|
{
|
||||||
char *line, *cause;
|
char *line, *cause;
|
||||||
struct cmd_list *cmdlist;
|
struct cmd_list *cmdlist;
|
||||||
|
struct cmd *cmd;
|
||||||
|
|
||||||
if (closed)
|
if (closed)
|
||||||
c->flags |= CLIENT_EXIT;
|
c->flags |= CLIENT_EXIT;
|
||||||
@ -78,6 +79,8 @@ control_callback(struct client *c, int closed, unused void *data)
|
|||||||
|
|
||||||
free(cause);
|
free(cause);
|
||||||
} else {
|
} else {
|
||||||
|
TAILQ_FOREACH(cmd, &cmdlist->list, qentry)
|
||||||
|
cmd->flags |= CMD_CONTROL;
|
||||||
cmdq_run(c->cmdq, cmdlist);
|
cmdq_run(c->cmdq, cmdlist);
|
||||||
cmd_list_free(cmdlist);
|
cmd_list_free(cmdlist);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user