diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-08-18 10:18:02 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-08-18 10:18:02 -0500 |
commit | 89ccf5799557691889f01ed85b38ac63be227f4a (patch) | |
tree | 6f8cb902e1e232296aca6bfd707db2abd5b420d9 | |
parent | cbc3f6018370aaf7a5f8a35b41ce886ace340fd2 (diff) | |
parent | a100be9a91a57f82cccb7978ac1adea376ca9908 (diff) |
Merge pull request #726 from pvmart/master
fix leaking ets tables when compilation failed
-rw-r--r-- | src/rebar_erlc_compiler.erl | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 4c76429..9dbe005 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -169,17 +169,20 @@ doterl_compile(Config, Dir, OutDir, MoreSources, ErlOpts) -> DepErlsOrdered = digraph_utils:topsort(SubGraph), FirstErls = ErlFirstFiles ++ lists:reverse(DepErlsOrdered), ?DEBUG("Files to compile first: ~p", [FirstErls]), - rebar_base_compiler:run( - Config, FirstErls, OtherErls, - fun(S, C) -> - ErlOpts1 = case lists:member(S, ErlFirstFiles) of - true -> ErlOptsFirst; - false -> ErlOpts - end, - internal_erl_compile(C, Dir, S, OutDir1, ErlOpts1) - end), - true = digraph:delete(SubGraph), - true = digraph:delete(G), + try + rebar_base_compiler:run( + Config, FirstErls, OtherErls, + fun(S, C) -> + ErlOpts1 = case lists:member(S, ErlFirstFiles) of + true -> ErlOptsFirst; + false -> ErlOpts + end, + internal_erl_compile(C, Dir, S, OutDir1, ErlOpts1) + end) + after + true = digraph:delete(SubGraph), + true = digraph:delete(G) + end, ok. %% Get files which need to be compiled first, i.e. those specified in erl_first_files |