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 @@ -711,16 +711,22 @@ defmodule Mix.Compilers.Elixir do
711
711
712
712
defp remove_and_purge ( beam , module ) do
713
713
_ = File . rm ( beam )
714
- :code . purge ( module )
715
- :code . delete ( module )
714
+
715
+ if Code . loaded? ( module ) do
716
+ :code . purge ( module )
717
+ :code . delete ( module )
718
+ end
716
719
end
717
720
718
721
defp purge_modules_in_path ( path ) do
719
722
with { :ok , beams } <- File . ls ( path ) do
720
723
Enum . each ( beams , fn beam ->
721
724
module = beam |> Path . rootname ( ) |> String . to_atom ( )
722
- :code . purge ( module )
723
- :code . delete ( module )
725
+
726
+ if Code . loaded? ( module ) do
727
+ :code . purge ( module )
728
+ :code . delete ( module )
729
+ end
724
730
end )
725
731
end
726
732
end
@@ -898,9 +904,7 @@ defmodule Mix.Compilers.Elixir do
898
904
end
899
905
900
906
for { module , _ } <- data do
901
- File . rm ( beam_path ( compile_path , module ) )
902
- :code . purge ( module )
903
- :code . delete ( module )
907
+ remove_and_purge ( beam_path ( compile_path , module ) , module )
904
908
end
905
909
rescue
906
910
_ ->
You can’t perform that action at this time.
0 commit comments