mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 02:52:07 +00:00
Fix leaking file descriptors
When passing a filehandle for update, clean it up on end of the update/upload.
This commit is contained in:
parent
83d92ecfcc
commit
814257fbf8
@ -103,6 +103,7 @@ class Updater(object):
|
||||
datfile = os.fdopen(os.dup(cf.fileno()), cf.mode)
|
||||
else:
|
||||
datfile = None
|
||||
self.datfile = datfile
|
||||
self.updateproc = updatepool.spawn(execupdate, handler, filename,
|
||||
self, type, owner, node, datfile)
|
||||
if type == 'firmware':
|
||||
@ -127,6 +128,8 @@ class Updater(object):
|
||||
|
||||
def cancel(self):
|
||||
self.updateproc.kill()
|
||||
if self.datfile:
|
||||
self.datfile.close()
|
||||
|
||||
@property
|
||||
def progress(self):
|
||||
|
Loading…
Reference in New Issue
Block a user