1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 08:38:20 +08:00

Fix: Remove shell warnings (#1425)

This commit is contained in:
LmeSzinc
2022-07-30 01:51:26 +08:00
parent c1ff4348e7
commit d32856cb90
3 changed files with 45 additions and 6 deletions

View File

@@ -61,7 +61,7 @@ def recv_all(stream, chunk_size=4096) -> bytes:
fragments.append(chunk)
else:
break
return b''.join(fragments)
return remove_shell_warning(b''.join(fragments))
except socket.timeout:
raise AdbTimeout('adb read timeout')
@@ -172,6 +172,38 @@ def get_serial_pair(serial):
return None, None
def remove_prefix(s, prefix):
"""
Remove prefix of a string or bytes like `string.removeprefix(prefix)`, which is on Python3.9+
Args:
s (str, bytes):
prefix (str, bytes):
Returns:
str, bytes:
"""
return s[len(prefix):] if s.startswith(prefix) else s
def remove_shell_warning(s):
"""
Remove warnings from shell
Args:
s (str, bytes):
Returns:
str, bytes:
"""
if isinstance(s, bytes):
s = remove_prefix(s, b'WARNING: linker: [vdso]: unused DT entry: type 0x70000001 arg 0x0\n')
elif isinstance(s, str):
s = remove_prefix(s, 'WARNING: linker: [vdso]: unused DT entry: type 0x70000001 arg 0x0\n')
return s
class IniterNoMinicap(u2.init.Initer):
@property
def minicap_urls(self):