fix: open dispatcher lock file with explicit utf-8 encoding

ruff (unspecified-encoding) and the Windows-footgun checker both flag
open() in text mode without encoture=. Keep text mode (the Windows lock
path in _try_acquire_file_lock writes a str newline) and pass
encoding='utf-8'.
This commit is contained in:
Teknium 2026-06-19 07:06:13 -07:00
parent 226e9322e1
commit ba50e86563

View file

@ -51,7 +51,7 @@ def _acquire_singleton_lock(lock_path) -> "tuple[Optional[object], str]":
return None, "unavailable"
try:
Path(lock_path).parent.mkdir(parents=True, exist_ok=True)
handle = open(str(lock_path), "a+")
handle = open(str(lock_path), "a+", encoding="utf-8")
except OSError:
return None, "unavailable"
if not _try_acquire_file_lock(handle):