This commit is contained in:
edschuy95 2026-01-20 20:59:52 -05:00
parent cb29928ba0
commit 3ea2b748d6

View file

@ -89,19 +89,19 @@ ANSI_ESCAPE_RE = re.compile(
# ==========================================================
# ===================== UTILITY FUNCTIONS =================
def apply_backspaces(s):
# Ensure we are working with str
if isinstance(s, bytes):
s = s.decode(errors="ignore")
# def apply_backspaces(s):
# # Ensure we are working with str
# if isinstance(s, bytes):
# s = s.decode(errors="ignore")
buf = []
for c in s:
if c == "\x08":
if buf:
buf.pop()
else:
buf.append(c)
return "".join(buf)
# buf = []
# for c in s:
# if c == "\x08":
# if buf:
# buf.pop()
# else:
# buf.append(c)
# return "".join(buf)
def acquire_single_instance(lockfile_base: str):
"""
@ -380,8 +380,8 @@ def monitor_game_pty(master_fd):
while b"\n" in buffer:
line, buffer = buffer.split(b"\n", 1)
if os.name != "nt":
line = apply_backspaces(line)
#if os.name != "nt":
# line = apply_backspaces(line)
line = strip_ansi(line.decode(errors="ignore")).strip()
if line:
if "--debug" in sys.argv: