Add a flag to make a client wait for an empty line before exiting in

control mode to avoid stray commands ending up in the shell.
This commit is contained in:
nicm
2020-06-18 08:34:22 +00:00
parent 1bf9555e4f
commit 2372b0fdc6
6 changed files with 44 additions and 6 deletions

View File

@ -2370,6 +2370,8 @@ server_client_control_flags(struct client *c, const char *next)
}
if (strcmp(next, "no-output") == 0)
return (CLIENT_CONTROL_NOOUTPUT);
if (strcmp(next, "wait-exit") == 0)
return (CLIENT_CONTROL_WAITEXIT);
return (0);
}
@ -2409,6 +2411,7 @@ server_client_set_flags(struct client *c, const char *flags)
control_reset_offsets(c);
}
free(copy);
proc_send(c->peer, MSG_FLAGS, -1, &c->flags, sizeof c->flags);
}
/* Get client flags. This is only flags useful to show to users. */
@ -2427,6 +2430,8 @@ server_client_get_flags(struct client *c)
strlcat(s, "ignore-size,", sizeof s);
if (c->flags & CLIENT_CONTROL_NOOUTPUT)
strlcat(s, "no-output,", sizeof s);
if (c->flags & CLIENT_CONTROL_WAITEXIT)
strlcat(s, "wait-exit,", sizeof s);
if (c->flags & CLIENT_CONTROL_PAUSEAFTER) {
xsnprintf(tmp, sizeof tmp, "pause-after=%u,",
c->pause_age / 1000);