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