Skip to content

Commit e57c69d

Browse files
move catch to inside recursive loop
1 parent b0d8ea9 commit e57c69d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

base/file.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,14 @@ function rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
289289
end
290290
else
291291
if recursive
292-
try
293-
for p in readdir(path)
294-
rm(joinpath(path, p), force=force, recursive=true)
295-
end
296-
catch err
297-
if !(isa(err, IOError) && err.code==Base.UV_EACCES)
298-
rethrow(err)
292+
for p in readdir(path)
293+
fp = joinpath(path, p)
294+
try
295+
rm(fp, force=force, recursive=true)
296+
catch err
297+
if !(isa(err, IOError) && err.code==Base.UV_EACCES)
298+
rethrow()
299+
end
299300
end
300301
end
301302
end

0 commit comments

Comments
 (0)