Skip to content

Commit 7443b60

Browse files
committed
Fix issue #117 with rename-session on tmux 2.7
tmux 2.7 on BSD systems (including macOS) can raise no current client. See Also: - https://www.mail-archive.com/[email protected]/msg45186.html - https://marc.info/?l=openbsd-cvs&m=152183263526828&w=2 This makes sure that rename_session won't raise the warning on OS X systems.
1 parent a1a00ad commit 7443b60

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

libtmux/session.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from . import exc, formats
1414
from ._compat import text_type
15-
from .common import EnvironmentMixin, TmuxMappingObject, \
15+
from .common import EnvironmentMixin, has_version, TmuxMappingObject, \
1616
TmuxRelationalObject, session_check_name, handle_option_error
1717
from .window import Window
1818

@@ -152,14 +152,20 @@ def rename_session(self, new_name):
152152
"""
153153
session_check_name(new_name)
154154

155-
proc = self.cmd(
156-
'rename-session',
157-
'-t%s' % self.id,
158-
new_name
159-
)
155+
proc = self.cmd('rename-session', new_name)
160156

161157
if proc.stderr:
162-
raise exc.LibTmuxException(proc.stderr)
158+
if has_version('2.7') and 'no current client' in proc.stderr:
159+
"""tmux 2.7 raises "no current client" warning on BSD systems.
160+
161+
Should be fixed next release:
162+
163+
- https://www.mail-archive.com/[email protected]/msg45186.html
164+
- https://marc.info/?l=openbsd-cvs&m=152183263526828&w=2
165+
"""
166+
pass
167+
else:
168+
raise exc.LibTmuxException(proc.stderr)
163169

164170
return self
165171

0 commit comments

Comments
 (0)