Skip to content

Commit

Permalink
Merge pull request #1321 from vans163/error_on_load_file_failure
Browse files Browse the repository at this point in the history
log error if a module failed to load_file, the user should be aware
  • Loading branch information
ferd authored Sep 15, 2016
2 parents 6a8150e + 9ab25aa commit cba1a1f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/rebar_agent.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ reload_modules(Modules, true) ->
on_load_not_allowed ->
reload_modules([ModError], false),
[ModError|Acc];
_ -> [ModError|Acc]
_ ->
?DEBUG("Module ~p failed to atomic load because ~p", [ModError, Error]),
[ModError|Acc]
end
end,
[], ModRsns
Expand All @@ -152,4 +154,13 @@ reload_modules(Modules, true) ->

%% Older versions, use a more ad-hoc mechanism.
reload_modules(Modules, false) ->
[begin code:delete(M), code:purge(M), code:load_file(M) end || M <- Modules].
lists:foreach(fun(M) ->
code:delete(M),
code:purge(M),
case code:load_file(M) of
{module, M} -> ok;
{error, Error} ->
?DEBUG("Module ~p failed to load because ~p", [M, Error])
end
end, Modules
).

0 comments on commit cba1a1f

Please sign in to comment.