storage: fix _atomic_write to create hidden temporary files (#2010)
This commit is contained in:
parent
3b087fba26
commit
b3a715a3b9
|
@ -51,7 +51,9 @@ def atomic_write(path, content, async=False):
|
|||
'''Rewrite a complete file automatically, that is write to new file with
|
||||
temporary name, fsync, then rename to final name. Use threads to remove blocking.'''
|
||||
def doit():
|
||||
fd, temp = tempfile.mkstemp(dir=os.path.dirname(path), prefix=os.path.basename(path))
|
||||
dirname = os.path.dirname(path)
|
||||
fd, temp = tempfile.mkstemp(dir=dirname,
|
||||
prefix='.tmp-'+os.path.basename(path)+'-')
|
||||
f = os.fdopen(fd, "w")
|
||||
if hasattr(content, 'read'):
|
||||
# file pointer
|
||||
|
|
Loading…
Reference in New Issue