summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpvmart <mao@jiadaochipingguo.local>2015-08-18 22:48:00 +0800
committerpvmart <mao@jiadaochipingguo.local>2015-08-18 22:48:00 +0800
commita100be9a91a57f82cccb7978ac1adea376ca9908 (patch)
tree6f8cb902e1e232296aca6bfd707db2abd5b420d9 /src
parentcbc3f6018370aaf7a5f8a35b41ce886ace340fd2 (diff)
fix leaking ets tables when compilation failed
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlc_compiler.erl25
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