mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-23 04:21:25 +00:00
Soft-fail and block missing termios on Windows
This commit is contained in:
1 file changed
+5
-2
@@ -10,9 +10,11 @@ import os
|
||||
import select
|
||||
import shutil
|
||||
import sys
|
||||
import termios
|
||||
import time
|
||||
|
||||
try: import termios
|
||||
except: termios = None
|
||||
|
||||
from . import _ctlseqs
|
||||
|
||||
QUERY_TIMEOUT = 0.3
|
||||
@@ -43,7 +45,7 @@ def _open_tty():
|
||||
def query_tty(request, timeout=QUERY_TIMEOUT):
|
||||
# Sends a query to the terminal and returns the raw response.
|
||||
global _query_failed
|
||||
if _query_failed: return b""
|
||||
if _query_failed or not termios: return b""
|
||||
|
||||
fd = _open_tty()
|
||||
if fd == -1:
|
||||
@@ -121,6 +123,7 @@ def _cell_size_from_winsize(buf):
|
||||
|
||||
def _query_cell_size():
|
||||
# Determines the current cell size in pixels, or None if unknown.
|
||||
if not termios: return None
|
||||
fd = _open_tty()
|
||||
if fd != -1:
|
||||
# First, try the TIOCGWINSZ pixel fields (fast, no query)
|
||||
|
||||
Reference in new issue
Block a user