mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
bdc226a638
This is a hopefully more robust way of doing atomic writing of a file. Previously, we wrote a new temporary file on each write, and renamed it over the target file on success. This is technically neat, but constantly recreating the file causes problems with some network filesystems, and with sync tools like Dropbox. The new approach copies the old file contents to a temporary file, overwrites the target using standard open() and write() calls, and then removes the temporary file. In case of a failure during writing, the temporary file is renamed over the target, which should preserve the old data. This way, we're only using a new inode in case of a write failure, which is hopefully rare, instead of on successful writes. |
||
---|---|---|
.. | ||
auth | ||
base | ||
edit | ||
files | ||
kernelspecs | ||
nbconvert | ||
notebook | ||
services | ||
static | ||
templates | ||
terminal | ||
tests | ||
tree | ||
__init__.py | ||
__main__.py | ||
_sysinfo.py | ||
_version.py | ||
allow76.py | ||
jstest.py | ||
log.py | ||
nbextensions.py | ||
notebookapp.py | ||
submodule.py | ||
utils.py |