Update util.py

Signed-off-by: ed <s@ocv.me>
This commit is contained in:
ed 2026-01-30 17:48:15 +00:00 committed by GitHub
parent 591e959283
commit d275679c7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,6 +57,11 @@ from .__init__ import (
)
from .__version__ import S_BUILD_DT, S_VERSION
def noop(*a, **ka):
pass
try:
from datetime import datetime, timezone
@ -281,6 +286,9 @@ except:
BITNESS = struct.calcsize("P") * 8
CAN_SIGMASK = not (ANYWIN or PY2 or GRAAL)
RE_ANSI = re.compile("\033\\[[^mK]*[mK]")
RE_HTML_SH = re.compile(r"[<>&$?`\"';]")
RE_CTYPE = re.compile(r"^content-type: *([^; ]+)", re.IGNORECASE)
@ -780,7 +788,7 @@ class Daemon(threading.Thread):
self.start()
def run(self):
if not ANYWIN and not PY2 and not GRAAL:
if CAN_SIGMASK:
signal.pthread_sigmask(
signal.SIG_BLOCK, [signal.SIGINT, signal.SIGTERM, signal.SIGUSR1]
)
@ -1656,15 +1664,15 @@ def log_thrs(log: Callable[[str, str, int], None], ival: float, name: str) -> No
log(name, "\033[0m \033[33m".join(tv), 3)
def sigblock():
if ANYWIN or PY2 or GRAAL:
return
def _sigblock():
signal.pthread_sigmask(
signal.SIG_BLOCK, [signal.SIGINT, signal.SIGTERM, signal.SIGUSR1]
)
sigblock = _sigblock if CAN_SIGMASK else noop
def vol_san(vols: list["VFS"], txt: bytes) -> bytes:
txt0 = txt
for vol in vols: