From 70b2b2cff621aff181d286512671687ac8b57ed9 Mon Sep 17 00:00:00 2001 From: heapcrash Date: Sun, 30 May 2021 17:33:38 -0500 Subject: [PATCH] For tmux, always specify -F and -P Fixes #1898 --- pwnlib/util/misc.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index c0a0b3317..c640dfeeb 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -229,7 +229,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr args = [] elif 'TMUX' in os.environ and which('tmux'): terminal = 'tmux' - args = ['splitw', '-F' '#{pane_pid}', '-P'] + args = ['splitw'] elif 'STY' in os.environ and which('screen'): terminal = 'screen' args = ['-t','pwntools-gdb','bash','-c'] @@ -256,6 +256,12 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr if isinstance(args, tuple): args = list(args) + # When not specifying context.terminal explicitly, we used to set these flags above. + # However, if specifying terminal=['tmux', 'splitw', '-h'], we would be lacking these flags. + # Instead, set them here and hope for the best. + if terminal == 'tmux': + args += ['-F' '#{pane_pid}', '-P'] + argv = [which(terminal)] + args if isinstance(command, six.string_types):