-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
When saving a file, micro simply overwrites it with the new contents. So if writing is interrupted in the middle due to some error (e.g. running out of disk space, unplugging USB stick and so on), the file is left in a damaged state: partially written or just empty (i.e. the user's data is lost).
To prevent this, micro should save files atomically: first write to a temporary file, and then, if write completes successfully, replace the user's file with this temporary file. AFAIK this is how it is done by other editors.
This issue concerns not just the edited files themselves, but also other files that micro may modify: settings.json, bindings.json, backups and so on.
Commit hash: 59dda01
OS: any
Terminal: any
shaicoleman, zoomosis and plyght