Commit 4f098b35 authored by Guido van Rossum's avatar Guido van Rossum Committed by Terry Jan Reedy

bpo-36807: When saving a file in IDLE, call flush and fsync (#13102)

parent 3e2afd78
...@@ -384,6 +384,8 @@ class IOBinding: ...@@ -384,6 +384,8 @@ class IOBinding:
try: try:
with open(filename, "wb") as f: with open(filename, "wb") as f:
f.write(chars) f.write(chars)
f.flush()
os.fsync(f.fileno())
return True return True
except OSError as msg: except OSError as msg:
tkMessageBox.showerror("I/O Error", str(msg), tkMessageBox.showerror("I/O Error", str(msg),
......
When saving a file, call os.flush() so bits are flushed to e.g. USB drive.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment