mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Merge branch 'obsd-master'
This commit is contained in:
22
server-fn.c
22
server-fn.c
@ -455,7 +455,8 @@ server_destroy_session(struct session *s)
|
||||
void
|
||||
server_check_unattached(void)
|
||||
{
|
||||
struct session *s;
|
||||
struct session *s;
|
||||
struct session_group *sg;
|
||||
|
||||
/*
|
||||
* If any sessions are no longer attached and have destroy-unattached
|
||||
@ -464,8 +465,23 @@ server_check_unattached(void)
|
||||
RB_FOREACH(s, sessions, &sessions) {
|
||||
if (s->attached != 0)
|
||||
continue;
|
||||
if (options_get_number (s->options, "destroy-unattached"))
|
||||
session_destroy(s, 1, __func__);
|
||||
switch (options_get_number(s->options, "destroy-unattached")) {
|
||||
case 0: /* off */
|
||||
continue;
|
||||
case 1: /* on */
|
||||
break;
|
||||
case 2: /* keep-last */
|
||||
sg = session_group_contains(s);
|
||||
if (sg == NULL || session_group_count(sg) <= 1)
|
||||
continue;
|
||||
break;
|
||||
case 3: /* keep-group */
|
||||
sg = session_group_contains(s);
|
||||
if (sg != NULL && session_group_count(sg) == 1)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
session_destroy(s, 1, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user