=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-fn.c,v retrieving revision 1.128 retrieving revision 1.129 diff -u -r1.128 -r1.129 --- src/usr.bin/tmux/server-fn.c 2020/07/30 07:32:52 1.128 +++ src/usr.bin/tmux/server-fn.c 2021/01/04 08:43:16 1.129 @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.128 2020/07/30 07:32:52 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.129 2021/01/04 08:43:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -314,6 +314,7 @@ struct grid_cell gc; time_t t; char tim[26]; + int remain_on_exit; if (wp->fd != -1) { bufferevent_free(wp->event); @@ -322,10 +323,17 @@ wp->fd = -1; } - if (options_get_number(wp->options, "remain-on-exit")) { - if (~wp->flags & PANE_STATUSREADY) - return; - + remain_on_exit = options_get_number(wp->options, "remain-on-exit"); + if (remain_on_exit != 0 && (~wp->flags & PANE_STATUSREADY)) + return; + switch (remain_on_exit) { + case 0: + break; + case 2: + if (WIFEXITED(wp->status) && WEXITSTATUS(wp->status) == 0) + break; + /* FALLTHROUGH */ + case 1: if (wp->flags & PANE_STATUSDRAWN) return; wp->flags |= PANE_STATUSDRAWN;