summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/options-table.c8
-rw-r--r--usr.bin/tmux/server.c5
-rw-r--r--usr.bin/tmux/tmux.19
3 files changed, 18 insertions, 4 deletions
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index d192e30ea4d..d1dd3ec1620 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.94 2017/10/25 14:14:52 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.95 2018/02/22 10:54:51 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -97,6 +97,12 @@ const struct options_table_entry options_table[] = {
.default_num = 500
},
+ { .name = "exit-empty",
+ .type = OPTIONS_TABLE_FLAG,
+ .scope = OPTIONS_TABLE_SERVER,
+ .default_num = 1
+ },
+
{ .name = "exit-unattached",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_SERVER,
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 138c06fb298..7056838b90d 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.178 2017/12/19 15:00:39 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.179 2018/02/22 10:54:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -255,6 +255,9 @@ server_loop(void)
server_client_loop();
+ if (!options_get_number(global_options, "exit-empty") && !server_exit)
+ return (0);
+
if (!options_get_number(global_options, "exit-unattached")) {
if (!RB_EMPTY(&sessions))
return (0);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 3f12be737fc..4fb28f77588 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.591 2018/01/16 09:00:38 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.592 2018/02/22 10:54:51 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 16 2018 $
+.Dd $Mdocdate: February 22 2018 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -2503,6 +2503,11 @@ Set the time in milliseconds for which
waits after an escape is input to determine if it is part of a function or meta
key sequences.
The default is 500 milliseconds.
+.It Xo Ic exit-empty
+.Op Ic on | off
+.Xc
+If enabled (the default), the server will exit when there are no active
+sessions.
.It Xo Ic exit-unattached
.Op Ic on | off
.Xc