fix(utils): preserve exact newlines in atomic text writes (#6475)

* fix(utils): preserve exact newlines in atomic text writes

* test(updates): allow time for confirmed Windows upgrade completion
This commit is contained in:
Quanxin Liu authored and GitHub committed 2026-10-27 13:38:17 +08:00
1 parent 0978ccd50f
commit c4dac649da
3 files changed
+11 -6

No files matched your search

+1 -1
View File
@@ -137,7 +137,7 @@ def atomic_write_text(path: Path, content: str) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
tmp = path.with_name(f".{path.name}.{uuid.uuid4().hex}.tmp")
try:
with open(tmp, "x", encoding="utf-8") as handle:
with open(tmp, "x", encoding="utf-8", newline="") as handle:
handle.write(content)
handle.flush()
os.fsync(handle.fileno())