Skip to content

Commit

Permalink
For tmux, always specify -F and -P
Browse files Browse the repository at this point in the history
  • Loading branch information
heapcrash committed May 30, 2021
1 parent b2c83a7 commit 70b2b2c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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):
Expand Down

0 comments on commit 70b2b2c

Please sign in to comment.