.
This commit is contained in:
parent
cb29928ba0
commit
3ea2b748d6
1 changed files with 14 additions and 14 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue