summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_compile.erl2
-rw-r--r--src/rebar_utils.erl12
-rw-r--r--systest/all_SUITE.erl1
3 files changed, 9 insertions, 6 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 75e6eee..72320fb 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -145,7 +145,7 @@ compile(State, Providers, AppInfo) ->
code:add_pathsa(PluginDepsPaths),
AppFileCompileResult = rebar_otp_app:compile(State, AppInfo4),
%% Clean up after ourselves, leave things as they were.
- rebar_utils:remove_from_code_path(PluginDepsPaths, soft_purge),
+ rebar_utils:remove_from_code_path(PluginDepsPaths),
case AppFileCompileResult of
{ok, AppInfo5} ->
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 64d4952..b633760 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -49,7 +49,6 @@
update_code/1,
update_code/2,
remove_from_code_path/1,
- remove_from_code_path/2,
cleanup_code_path/1,
args_to_tasks/1,
expand_env_variable/3,
@@ -754,9 +753,6 @@ update_code(Paths, Opts) ->
end, Paths).
remove_from_code_path(Paths) ->
- remove_from_code_path(Paths, purge).
-
-remove_from_code_path(Paths, Type) when Type == purge; Type == soft_purge ->
lists:foreach(fun(Path) ->
Name = filename:basename(Path, "/ebin"),
App = list_to_atom(Name),
@@ -767,7 +763,13 @@ remove_from_code_path(Paths, Type) when Type == purge; Type == soft_purge ->
ok;
{ok, Modules} ->
application:unload(App),
- [begin code:Type(M), code:delete(M) end || M <- Modules]
+ [case erlang:check_process_code(self(), M) of
+ false ->
+ code:purge(M), code:delete(M);
+ _ ->
+ ?DEBUG("~p can't purge ~p safely, doing a soft purge", [self(), M]),
+ code:soft_purge(M) andalso code:delete(M)
+ end || M <- Modules]
end,
code:del_path(Path)
end, lists:usort(Paths)).
diff --git a/systest/all_SUITE.erl b/systest/all_SUITE.erl
index ba06a9c..6d2f14f 100644
--- a/systest/all_SUITE.erl
+++ b/systest/all_SUITE.erl
@@ -66,6 +66,7 @@ alias_clash(Config) ->
?assertNotEqual(nomatch,
re:run(Output, "Not adding provider default test from module rebar_prv_alias_test "
"because it already exists from module rebar_prv_alias_test")),
+ ok.
grisp_explode() ->
[{doc, "Don't force purge a plugin that runs the compile job itself"}].