aboutsummaryrefslogtreecommitdiffstats
path: root/idatui
diff options
context:
space:
mode:
authorDuncan Ogilvie <mr.exodia.tpodt@gmail.com>2026-08-17 15:21:59 +0200
committerDuncan Ogilvie <mr.exodia.tpodt@gmail.com>2026-08-17 15:21:59 +0200
commit61b93538fe6e03f175b907c19c2d196ecd860782 (patch)
tree822b667f5b1a6ea5b8358e2bc473d0069b0d1402 /idatui
parentdocs: be honest that the triskel fork is unpublished (diff)
downloadida-tui-61b93538fe6e03f175b907c19c2d196ecd860782.tar.gz
ida-tui-61b93538fe6e03f175b907c19c2d196ecd860782.tar.xz
ida-tui-61b93538fe6e03f175b907c19c2d196ecd860782.zip
Add kitty graphics fallback for Windows support
Diffstat (limited to 'idatui')
-rw-r--r--idatui/kittygfx.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/idatui/kittygfx.py b/idatui/kittygfx.py
index e53fba3..6f419ef 100644
--- a/idatui/kittygfx.py
+++ b/idatui/kittygfx.py
@@ -71,8 +71,16 @@ def log(msg: str) -> None:
# Detection
# --------------------------------------------------------------------------- #
def _query_tty(timeout: float = 2.0) -> bool:
- import termios
- import tty as ttymod
+ # ``termios`` and ``/dev/tty`` are POSIX-only. Native Windows terminals
+ # generally don't expose the synchronous reply channel this probe needs;
+ # use the ANSI-art splash there instead of making graphics fatal to the
+ # whole application. IDATUI_KITTY=1 still permits an explicit override.
+ try:
+ import termios
+ import tty as ttymod
+ except ImportError:
+ log("supported: tty queries are unavailable on this platform")
+ return False
try:
fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY)
@@ -136,7 +144,11 @@ def supported() -> bool:
_supported = False # pilot tests, pipes, redirected output
log("supported: stdout is not a tty")
else:
- _supported = _query_tty()
+ try:
+ _supported = _query_tty()
+ except Exception as exc: # graphics are optional on every platform
+ log(f"supported: terminal query failed ({type(exc).__name__}: {exc})")
+ _supported = False
log(f"supported() -> {_supported}")
return _supported