Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For tmux, always specify -F and -P #1902

Merged
merged 2 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ The table below shows which release corresponds to each branch, and what date th

| Version | Branch | Release Date |
| ---------------- | -------- | ---------------------- |
| [4.7.0](#470) | `dev` | May 29, 2020 (planned)
| [4.6.0](#460) | `beta` | May 29, 2020 (planned)
| [4.5.0](#450) | `stable` | Apr 30, 2020
| [4.7.0](#470) | `dev` |
| [4.6.0](#460) | `beta` |
| [4.5.1](#451) | `stable` | May 30, 2020
| [4.5.0](#450) | | Apr 30, 2020
| [4.4.0](#440) | | Mar 29, 2020
| [4.3.1](#431) | | Nov 29, 2020
| [4.3.0](#430) | | Oct 20, 2020
Expand Down Expand Up @@ -89,7 +90,13 @@ The table below shows which release corresponds to each branch, and what date th
[1776]: https://github.com/Gallopsled/pwntools/pull/1776
[1846]: https://github.com/Gallopsled/pwntools/pull/1846

## 4.5.0 (`stable`)
## 4.5.1 (`stable`)

- [#1902][1902] Always specify -F and -P for tmux in run_in_new_termianl

[1902]: https://github.com/Gallopsled/pwntools/pull/1902

## 4.5.0

- [#1261][1261] Misc `run_in_new_terminal` improvements (notably gdb terminated by default)
- [#1695][1695] Allow using GDB Python API
Expand Down
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