Skip to content

Commit 67e1d56

Browse files
Also allow errno.EBUSY during emptydirs on NFS
- Can occur if a file is still open somewhere, so NFS will rename it to a hidden file in the same directory - When `shutil` tries to delete that hidden file, we get an `OSError` with `errno.EBUSY`
1 parent 28d76cf commit 67e1d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nipype/utils/filemanip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def emptydirs(path, noexist_ok=False):
781781
shutil.rmtree(path)
782782
except OSError as ex:
783783
elcont = os.listdir(path)
784-
if ex.errno == errno.ENOTEMPTY and not elcont:
784+
if ex.errno in [errno.ENOTEMPTY, errno.EBUSY] and not elcont:
785785
fmlogger.warning(
786786
"An exception was raised trying to remove old %s, but the path"
787787
" seems empty. Is it an NFS mount?. Passing the exception.",

0 commit comments

Comments
 (0)