Skip to content

Commit 03c62e3

Browse files
fix: Add flush+fsync to write of config files
This is to lower the risk of corrupted config files
1 parent 5864398 commit 03c62e3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎aw_core/config.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ def save_config(appname, config):
3333
config_file_path = os.path.join(config_dir, "{}.ini".format(appname))
3434
with open(config_file_path, "w") as f:
3535
config.write(f)
36+
# Flush and fsync to lower risk of corrupted files
37+
f.flush()
38+
os.fsync(f.fileno())

0 commit comments

Comments
 (0)