diff --git a/debian/changelog b/debian/changelog index e5bab035..95efae5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,13 @@ byobu (5.125) unreleased; urgency=medium * usr/share/byobu/profiles/dircolors: LP: #1752352 - fix blinking symlinks + [ Chow Loong Jin ] + * usr/lib/byobu/include/select-session.py: + - Fix cull_zombies() so that we properly cull zombies of sessions that + have non-numeric session names + - Allow the dynamic session-creation behaviour to be disabled by + creating ~/.byobu/.reuse-session + -- Dustin Kirkland Mon, 04 Dec 2017 07:46:48 -0600 byobu (5.124-0ubuntu1) bionic; urgency=medium diff --git a/usr/lib/byobu/include/select-session.py b/usr/lib/byobu/include/select-session.py index a56a8363..4a7ef4fd 100755 --- a/usr/lib/byobu/include/select-session.py +++ b/usr/lib/byobu/include/select-session.py @@ -40,6 +40,7 @@ BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux") choice = -1 sessions = [] text = [] +reuse_sessions = os.path.exists("%s/.reuse-session" % (BYOBU_CONFIG_DIR)) BYOBU_UPDATE_ENVVARS = ["DISPLAY", "DBUS_SESSION_BUS_ADDRESS", "SESSION_MANAGER", "GPG_AGENT_INFO", "XDG_SESSION_COOKIE", "XDG_SESSION_PATH", "GNOME_KEYRING_CONTROL", "GNOME_KEYRING_PID", "GPG_AGENT_INFO", "SSH_ASKPASS", "SSH_AUTH_SOCK", "SSH_AGENT_PID", "WINDOWID", "UPSTART_JOB", "UPSTART_EVENTS", "UPSTART_SESSION", "UPSTART_INSTANCE"] @@ -102,7 +103,7 @@ def cull_zombies(session_name): # Find the master session to extract the group name. We use # the group number to be extra sure the right session is getting # killed. We don't want to accidentally kill the wrong one - pattern = "^%s:.+\\((group \\w+)\\).*$" % session_name + pattern = "^%s:.+\\((group [^\\)]+)\\).*$" % session_name master = re.search(pattern, output, re.MULTILINE) if not master: return @@ -131,7 +132,11 @@ def attach_session(session): cull_zombies(session_name) # must use the binary, not the wrapper! if backend == "tmux": - os.execvp("tmux", ["tmux", "-2", "new-session", "-t", session_name, "-s", "_%s-%i" % (session_name, os.getpid())]) + if reuse_sessions: + os.execvp("tmux", ["tmux", "attach", "-t", session_name]) + else: + os.execvp("tmux", ["tmux", "-2", "new-session", "-t", session_name, "-s", "_%s-%i" % (session_name, os.getpid())]) + else: os.execvp("screen", ["screen", "-AOxRR", session_name])