Fix failure to save settings on Windows (#114)

Signed-off-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com>
This commit is contained in:
Nathan Rennie-Waldock 2023-04-21 12:26:24 +01:00 committed by GitHub
parent 6e42368082
commit a5f8767094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,6 +131,10 @@ class AppriseConfigCache(object):
# Write our file to a temporary file
_, tmp_path = tempfile.mkstemp(suffix='.tmp', dir=path)
# Close the file handle provided by mkstemp()
# We're reopening it, and it can't be renamed while open on Windows
os.close(_)
if self.mode == AppriseStoreMode.HASH:
try:
with gzip.open(tmp_path, 'wb') as f: