Skip to content

Commit b93c5ac

Browse files
authored
Ignore colored_traceback error when TERM is unset (#2596)
* Ignore colored_traceback error when TERM is unset Fixes using pwntools in non-interactive sage scripts with newer colored_traceback versions. Fixes #2594 * Update CHANGELOG
1 parent da9797c commit b93c5ac

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The table below shows which release corresponds to each branch, and what date th
1111
| ---------------- | -------- | ---------------------- |
1212
| [5.0.0](#500-dev) | `dev` |
1313
| [4.15.0](#4150-beta) | `beta` |
14-
| [4.14.0](#4141-stable) | `stable` | Mar 24, 2025
14+
| [4.14.1](#4141-stable) | `stable` | Mar 24, 2025
1515
| [4.14.0](#4140) | | Jan 15, 2025
1616
| [4.13.1](#4131) | | Sep 29, 2024
1717
| [4.13.0](#4130) | | Aug 12, 2024
@@ -149,13 +149,15 @@ The table below shows which release corresponds to each branch, and what date th
149149
- [#2595][2595] libcdb: Add Ubuntu and Debian debuginfod servers to default list
150150
- [#2593][2593] Use unicorn on macOS w/ SIP enabled
151151
- [#2587][2587] Support longer function names in Windows `getexport` shellcode
152+
- [#2596][2596] Ignore `colored_traceback` error when TERM envvar is unset
152153

153154
[2545]: https://github.com/Gallopsled/pwntools/pull/2545
154155
[2567]: https://github.com/Gallopsled/pwntools/pull/2567
155156
[2576]: https://github.com/Gallopsled/pwntools/pull/2576
156157
[2595]: https://github.com/Gallopsled/pwntools/pull/2595
157158
[2593]: https://github.com/Gallopsled/pwntools/pull/2593
158159
[2587]: https://github.com/Gallopsled/pwntools/pull/2587
160+
[2596]: https://github.com/Gallopsled/pwntools/pull/2596
159161

160162
## 4.14.1 (`stable`)
161163

pwn/toplevel.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@
8989
except ImportError:
9090
pass
9191
else:
92-
colored_traceback.add_hook()
92+
try:
93+
colored_traceback.add_hook()
94+
except Exception:
95+
# Exception: curses.error
96+
# colored_traceback (curses.setupterm()) fails if TERM is unset.
97+
# This is not critical, so we just ignore it.
98+
# We cannot import `curses` for `curses.error` because it is not
99+
# available on all platforms (e.g. Windows).
100+
pass
93101

94102
# Equivalence with the default behavior of "from import *"
95103
# __all__ = [x for x in tuple(globals()) if not x.startswith('_')]

0 commit comments

Comments
 (0)