diff options
author | 2010-09-26 20:43:30 +0000 | |
---|---|---|
committer | 2010-09-26 20:43:30 +0000 | |
commit | 357766745fc3b9569b97549679da6320628eb37f (patch) | |
tree | 35345de27957e4f40d5c4f81723b6d17d0c1a21a /usr.bin/tmux/server.c | |
parent | Merge pmsi(4) into pms(4). From Alexandr Shadchin on tech@. (diff) | |
download | wireguard-openbsd-357766745fc3b9569b97549679da6320628eb37f.tar.xz wireguard-openbsd-357766745fc3b9569b97549679da6320628eb37f.zip |
Two new options:
- server option "exit-unattached" makes the server exit when no clients
are attached, even if sessions are present;
- session option "destroy-unattached" destroys a session once no clients
are attached to it.
These are useful for preventing tmux remaining in the background where
it is undesirable and when using tmux as a login shell to keep a limit
on new sessions.
Diffstat (limited to 'usr.bin/tmux/server.c')
-rw-r--r-- | usr.bin/tmux/server.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 973f0c40a65..f13b3b98bd2 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.93 2010/09/26 18:51:48 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.94 2010/09/26 20:43:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -222,15 +222,17 @@ server_loop(void) } } -/* Check if the server should be shutting down (no more clients or windows). */ +/* Check if the server should be shutting down (no more clients or sessions). */ int server_should_shutdown(void) { u_int i; - for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { - if (ARRAY_ITEM(&sessions, i) != NULL) - return (0); + if (!options_get_number(&global_options, "exit-unattached")) { + for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { + if (ARRAY_ITEM(&sessions, i) != NULL) + return (0); + } } for (i = 0; i < ARRAY_LENGTH(&clients); i++) { if (ARRAY_ITEM(&clients, i) != NULL) |