mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 19:22:59 -03:00
Prevent crashing when cleaning up file, if file is still in use
This commit is contained in:
parent
3e2901ad8c
commit
8e200cd8b0
1 changed files with 10 additions and 6 deletions
|
@ -95,10 +95,14 @@ class OnionShare(object):
|
||||||
"""
|
"""
|
||||||
self.common.log('OnionShare', 'cleanup')
|
self.common.log('OnionShare', 'cleanup')
|
||||||
|
|
||||||
# cleanup files
|
# Cleanup files
|
||||||
for filename in self.cleanup_filenames:
|
try:
|
||||||
if os.path.isfile(filename):
|
for filename in self.cleanup_filenames:
|
||||||
os.remove(filename)
|
if os.path.isfile(filename):
|
||||||
elif os.path.isdir(filename):
|
os.remove(filename)
|
||||||
shutil.rmtree(filename)
|
elif os.path.isdir(filename):
|
||||||
|
shutil.rmtree(filename)
|
||||||
|
except:
|
||||||
|
# Don't crash if file is still in use
|
||||||
|
pass
|
||||||
self.cleanup_filenames = []
|
self.cleanup_filenames = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue