File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1077,7 +1077,11 @@ defmodule IEx.Helpers do
10771077 IO . puts ( IEx . color ( :eval_error , "No such file or directory #{ path } " ) )
10781078
10791079 { :error , :enotdir } ->
1080- IO . puts ( IEx . color ( :eval_info , Path . absname ( path ) ) )
1080+ if File . exists? ( path ) do
1081+ IO . puts ( IEx . color ( :eval_info , Path . absname ( path ) ) )
1082+ else
1083+ IO . puts ( IEx . color ( :eval_error , "Not a directory #{ path } " ) )
1084+ end
10811085 end
10821086
10831087 dont_display_result ( )
Original file line number Diff line number Diff line change @@ -1213,6 +1213,15 @@ defmodule IEx.HelpersTest do
12131213 "No such file or directory unknown_dir\n "
12141214 end )
12151215 end
1216+
1217+ test "prints an error if part of the path is not a dir (enotdir)" do
1218+ File . cd! ( iex_path ( ) , fn ->
1219+ path = Path . join ( "mix.exs" , "foo" )
1220+
1221+ assert capture_io ( fn -> ls ( path ) end ) ==
1222+ "Not a directory #{ path } \n "
1223+ end )
1224+ end
12161225 end
12171226
12181227 describe "exports" do
You can’t perform that action at this time.
0 commit comments