Skip to content

Commit 2851944

Browse files
committed
Fix on Windows which returns :eio on non-dir file
1 parent dc9c995 commit 2851944

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,15 +1080,17 @@ defmodule IEx.Helpers do
10801080
{:error, :enoent} ->
10811081
IO.puts(IEx.color(:eval_error, "No such file or directory #{path}"))
10821082

1083-
{:error, :enotdir} ->
1084-
if File.exists?(path) do
1085-
IO.puts(IEx.color(:eval_info, Path.absname(path)))
1086-
else
1087-
IO.puts(IEx.color(:eval_error, "No such file or directory #{path}"))
1088-
end
1089-
10901083
{:error, reason} ->
1091-
IO.puts(IEx.color(:eval_error, :file.format_error(reason)))
1084+
cond do
1085+
File.exists?(path) and not File.dir?(path) ->
1086+
IO.puts(IEx.color(:eval_info, Path.absname(path)))
1087+
1088+
reason == :enotdir ->
1089+
IO.puts(IEx.color(:eval_error, "No such file or directory #{path}"))
1090+
1091+
true ->
1092+
IO.puts(IEx.color(:eval_error, :file.format_error(reason)))
1093+
end
10921094
end
10931095

10941096
dont_display_result()

0 commit comments

Comments
 (0)