insanum / sncli

Simplenote CLI
MIT License
396 stars 34 forks source link

Keep temp files to avoid losing data #90

Closed samuelallan72 closed 5 years ago

samuelallan72 commented 5 years ago

This prevents tempfiles from editing notes from being cleaned up by sncli. It also logs the filenames to sncli.log for easy discovery.

Ideally we would have a method to auto clean-up the temp files after a certain time or when it is sure that the notes have been saved and/or synced. For now this is a solution anyway. For the privacy conscious, if this PR is merged, it means that tempfiles from your notes will be left around in the tempdir until manually cleaned up.

Ref #82

samuelallan72 commented 5 years ago

@qcu, @sobjornstad please review this and let me know if this seems like a solution to #82

samuelallan72 commented 5 years ago

Also pinging @1094 since you :+1: reacted to #82

sobjornstad commented 5 years ago

Feels a little messy to just leave them lying around, but I can't think of any better ways off the top of my head. It certainly seems like it ought to prevent any data loss, and the addition of the prefixes makes it reasonably discoverable behavior even without needing to know about it in the documentation. Would fix the problem for me.

samuelallan72 commented 5 years ago

@sobjornstad yeah ideally we would add something to track the file handles and then clean them up once a sync or note save completed successfully. I can look into it when I get more time.

casutherland commented 5 years ago

@swalladge Many thanks for taking the time to address this issue. Looks like a great interim approach until we can determine when/how to best safely delete the tmp file. I am running my daily notes off the branch build now.

samuelallan72 commented 5 years ago

Merged to master. I'll cut a new release with this fix soon.