mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
util: close temporary file descriptor
When we moved away from the core mercurial atomic temp logic, we forgot to close the file descriptor that was opened by mkstemp.
This commit is contained in:
parent
9f5acf47bd
commit
02c488a9f6
@ -121,6 +121,8 @@ def writefile(path, content, readonly=False):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
fd, temp = tempfile.mkstemp(prefix='.%s-' % filename, dir=dirname)
|
fd, temp = tempfile.mkstemp(prefix='.%s-' % filename, dir=dirname)
|
||||||
|
os.close(fd)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = util.posixfile(temp, 'wb')
|
f = util.posixfile(temp, 'wb')
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
Loading…
Reference in New Issue
Block a user