Skip to content

Commit

Permalink
guard against isdir EACESS in completions (#3877)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Apr 30, 2024
1 parent b9c39a7 commit 299b770
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ext/REPLExt/completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ function complete_expanded_local_dir(s, i1, i2, expanded_user, oldi2)
cmp = REPL.REPLCompletions.complete_path(s, i2, shell_escape=true)
cmp2 = cmp[2]
completions = [REPL.REPLCompletions.completion_text(p) for p in cmp[1]]
completions = filter!(x -> isdir(s[1:prevind(s, first(cmp2)-i1+1)]*x), completions)
completions = filter!(completions) do x
try
isdir(s[1:prevind(s, first(cmp2)-i1+1)]*x)
catch e
if e isa Base.IOError && e.code == Base.UV_EACCES
return false
else
rethrow()
end
end
end
if expanded_user
if length(completions) == 1 && endswith(joinpath(homedir(), ""), first(completions))
completions = [joinpath(s, "")]
Expand Down

0 comments on commit 299b770

Please sign in to comment.