Skip to content

Commit 926f291

Browse files
committed
Fix select_window() by providing the session ID as argument to -t
Previosly select_window() would not work in nested tmux scenarios, as there was no tmux session ID in the final tmux command. This is because select_window() already adds the '-t' argument, hence the check in cmd() does not add the session ID. Thanks to Fabian Lesniak and Andreas Fried for pointing this out. Fixes #161
1 parent 16d51b3 commit 926f291

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libtmux/session.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ def select_window(self, target_window):
357357
assure ``-l``, ``-n``, ``-p`` work.
358358
"""
359359

360-
target = '-t%s' % target_window
360+
# Note that we also provide the session ID here, since cmd()
361+
# will not automatically add it as there is already a '-t'
362+
# argument provided.
363+
target = '-t%s:%s' % (_session_id, target_window)
361364

362365
proc = self.cmd('select-window', target)
363366

0 commit comments

Comments
 (0)