Skip to content

Commit 1af489f

Browse files
committed
Fix X11 update_auth chaange to work on Windows
Commit 9e32fd1 worked fine on Linux and macOS, but removing the close of new_file before doing the file rename caused errors on Windows. This adds back the explicit file close before calling os.replace() when there's no error. If there is an error, though, the "with" statement will still trigger a close.
1 parent 9e32fd1 commit 1af489f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

asyncssh/x11.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ async def update_xauth(auth_path: Optional[str], host: str, dpynum: str,
503503
entry.dpynum != new_entry.dpynum):
504504
new_file.write(bytes(entry))
505505

506+
new_file.close()
507+
506508
os.replace(new_auth_path, auth_path)
507509

508510

0 commit comments

Comments
 (0)