summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-06-18 08:34:23 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-06-18 08:34:23 +0000
commitc50abd069038115a9946520c2d8d0a103fcbbe48 (patch)
tree800c9dea4847a4ec80db9734c944277cc5150f6a /usr.bin/tmux/server-client.c
parent1edc1e683741f2cac0146a729e56c9ecfdd6018b (diff)
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.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 44b7632a445..43f479b0332 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.357 2020/06/10 07:27:10 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.358 2020/06/18 08:34:22 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);