diff options
author | Tristan Sloughter <t@crashfast.com> | 2016-04-04 13:30:45 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2016-04-04 13:30:45 -0500 |
commit | 86054f2b224173c0878c51d69fd5658219b97129 (patch) | |
tree | 01d52de51919d0c3116ae4d21145ff2f550626ed | |
parent | 0be32c78f0f8849cf601afae9f9e14f9cf1de12c (diff) | |
parent | 359d486c36cb2c41489b535e85412799a099c0cc (diff) |
Merge pull request #1147 from ferd/blacklist-shell-reloads
Blacklist apps to reload
-rw-r--r-- | src/rebar_agent.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rebar_agent.erl b/src/rebar_agent.erl index 2b69812..95818d8 100644 --- a/src/rebar_agent.erl +++ b/src/rebar_agent.erl @@ -86,6 +86,8 @@ refresh_paths(RState) -> || App <- rebar_state:project_apps(RState)] %% make sure to never reload self; halt()s the VM ) -- [filename:dirname(code:which(?MODULE))], + %% Modules from apps we can't reload without breaking functionality + Blacklist = [ec_cmd_log, providers, cf, cth_readable], %% Similar to rebar_utils:update_code/1, but also forces a reload %% of used modules. Also forces to reload all of ebin/ instead %% of just the modules in the .app file, because 'extra_src_dirs' @@ -102,11 +104,16 @@ refresh_paths(RState) -> undefined -> code:add_patha(Path), ok; - {ok, _} -> - ?DEBUG("reloading ~p from ~s", [Modules, Path]), - code:replace_path(App, Path), - [begin code:purge(M), code:delete(M), code:load_file(M) end - || M <- Modules] + {ok, Mods} -> + case {length(Mods), length(Mods -- Blacklist)} of + {X,X} -> + ?DEBUG("reloading ~p from ~s", [Modules, Path]), + code:replace_path(App, Path), + [begin code:purge(M), code:delete(M), code:load_file(M) end + || M <- Modules]; + {_,_} -> + ?DEBUG("skipping app ~p, stable copy required", [App]) + end end end, ToRefresh). |