diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-12-06 11:37:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-06 11:37:07 -0500 |
commit | 8b2bca0e64d5f54b97f6315aa5b2c3380ed92c99 (patch) | |
tree | 0404d9c817ae3de555f1b1cc757d725af2beaf67 /src | |
parent | db05d1ead04f5928a0e865d8317ad6204637cc48 (diff) | |
parent | f12871451f2c60bc35da053198ccc48d1b1db687 (diff) |
Merge pull request #1686 from ferd/global-plugin-path-fix
Prevent plugin unloading from killing currently running command (soft-purge in-compile)
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_utils.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 5ea0452..b633760 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -763,7 +763,13 @@ remove_from_code_path(Paths) -> ok; {ok, Modules} -> application:unload(App), - [begin code:purge(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)). |