File tree 1 file changed +11
-7
lines changed
lib/mix/lib/mix/compilers
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -735,16 +735,22 @@ defmodule Mix.Compilers.Elixir do
735
735
736
736
defp remove_and_purge ( beam , module ) do
737
737
_ = File . rm ( beam )
738
- :code . purge ( module )
739
- :code . delete ( module )
738
+
739
+ if Code . loaded? ( module ) do
740
+ :code . purge ( module )
741
+ :code . delete ( module )
742
+ end
740
743
end
741
744
742
745
defp purge_modules_in_path ( path ) do
743
746
with { :ok , beams } <- File . ls ( path ) do
744
747
Enum . each ( beams , fn beam ->
745
748
module = beam |> Path . rootname ( ) |> String . to_atom ( )
746
- :code . purge ( module )
747
- :code . delete ( module )
749
+
750
+ if Code . loaded? ( module ) do
751
+ :code . purge ( module )
752
+ :code . delete ( module )
753
+ end
748
754
end )
749
755
end
750
756
end
@@ -922,9 +928,7 @@ defmodule Mix.Compilers.Elixir do
922
928
end
923
929
924
930
for { module , _ } <- data do
925
- File . rm ( beam_path ( compile_path , module ) )
926
- :code . purge ( module )
927
- :code . delete ( module )
931
+ remove_and_purge ( beam_path ( compile_path , module ) , module )
928
932
end
929
933
rescue
930
934
_ ->
You can’t perform that action at this time.
0 commit comments