To ensure that config and state files are mutated atomically, updates are done by creating a temporary file, writing the new content, and doing an os.rename call to replace the old file with the temporary file. However, until this commit, the temporary file was create in the OS' default temp dir. In some environment (Codespaces), this directory isn't on the same filesystem as the target file.
The solution is to create the temp file in the target directory. It might end up leaving some artifacts if the process were to die before cleaning it up, but that's better than failing on such a common case as having more multiple filesystems.
To ensure that config and state files are mutated atomically, updates are done by creating a temporary file, writing the new content, and doing an
os.rename
call to replace the old file with the temporary file. However, until this commit, the temporary file was create in the OS' default temp dir. In some environment (Codespaces), this directory isn't on the same filesystem as the target file.The solution is to create the temp file in the target directory. It might end up leaving some artifacts if the process were to die before cleaning it up, but that's better than failing on such a common case as having more multiple filesystems.
Fixes https://github.com/humanlogio/humanlog/issues/57