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 @@ -1081,7 +1081,11 @@ defmodule IEx.Helpers do
10811081 IO . puts ( IEx . color ( :eval_error , "No such file or directory #{ path } " ) )
10821082
10831083 { :error , :enotdir } ->
1084- IO . puts ( IEx . color ( :eval_info , Path . absname ( path ) ) )
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 , "Not a directory #{ path } " ) )
1088+ end
10851089
10861090 { :error , reason } ->
10871091 IO . puts ( IEx . color ( :eval_error , :file . format_error ( reason ) ) )
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