Closed samuelallan72 closed 5 years ago
@qcu, @sobjornstad please review this and let me know if this seems like a solution to #82
Also pinging @1094 since you :+1: reacted to #82
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.
@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.
@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.
Merged to master. I'll cut a new release with this fix soon.
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