Atomic save should use the target of symlinks

This commit is contained in:
Kovid Goyal
2021-08-08 10:35:38 +05:30
parent 7d1c26202a
commit 71f1f3aa64

View File

@@ -36,6 +36,7 @@ def build_ansi_color_table(opts: Optional[Options] = None) -> int:
def atomic_save(data: bytes, path: str) -> None:
import tempfile
path = os.path.realpath(path)
fd, p = tempfile.mkstemp(dir=os.path.dirname(path), suffix='.tmp')
try:
with os.fdopen(fd, 'wb') as f: