Skip to content

Commit fcea4b4

Browse files
lukaszsamsonjosevalim
authored andcommitted
Handle filesystem errors in iex helpers (#14618)
`File.cd` and `File.ls` can return any posix error code
1 parent 24e63cc commit fcea4b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,9 @@ defmodule IEx.Helpers do
10351035

10361036
{:error, :enoent} ->
10371037
IO.puts(IEx.color(:eval_error, "No directory #{directory}"))
1038+
1039+
{:error, reason} ->
1040+
IO.puts(IEx.color(:eval_error, :file.format_error(reason)))
10381041
end
10391042

10401043
dont_display_result()
@@ -1079,6 +1082,9 @@ defmodule IEx.Helpers do
10791082

10801083
{:error, :enotdir} ->
10811084
IO.puts(IEx.color(:eval_info, Path.absname(path)))
1085+
1086+
{:error, reason} ->
1087+
IO.puts(IEx.color(:eval_error, :file.format_error(reason)))
10821088
end
10831089

10841090
dont_display_result()

0 commit comments

Comments
 (0)