mirror of https://gitlab.com/ita1024/waf.git
Issue 1487 - there can be race conditions or other kinds of errors to ignore
This commit is contained in:
parent
02ad15eb17
commit
620dea5fb7
|
@ -187,13 +187,16 @@ class Node(object):
|
|||
os.chmod(self.abspath(), val)
|
||||
|
||||
def delete(self):
|
||||
"""Delete the file/folders if it exists, and remove this node from the tree. Do not use this object after calling this method."""
|
||||
"""Delete the file/folder, and remove this node from the tree. Do not use this object after calling this method."""
|
||||
try:
|
||||
try:
|
||||
if os.path.exists(self.abspath()):
|
||||
if hasattr(self, 'children'):
|
||||
shutil.rmtree(self.abspath())
|
||||
else:
|
||||
os.remove(self.abspath())
|
||||
except OSError as e:
|
||||
if os.path.exists(self.abspath()):
|
||||
raise e
|
||||
finally:
|
||||
self.evict()
|
||||
|
||||
|
|
Loading…
Reference in New Issue