Fix Dialyzer (race condition) warning

This commit is contained in:
Tuncer Ayaz 2012-02-02 22:50:32 +01:00
parent fe1652e137
commit a176db6937

View file

@ -190,10 +190,11 @@ expand_env_variable(InStr, VarName, RawVarValue) ->
vcs_vsn(Vcs, Dir) -> vcs_vsn(Vcs, Dir) ->
Key = {Vcs, Dir}, Key = {Vcs, Dir},
case ets:lookup(rebar_vsn_cache, Key) of try ets:lookup_element(rebar_vsn_cache, Key, 2) of
[{Key, VsnString}] -> VsnString ->
VsnString; VsnString
[] -> catch
error:badarg ->
VsnString = vcs_vsn_1(Vcs, Dir), VsnString = vcs_vsn_1(Vcs, Dir),
ets:insert(rebar_vsn_cache, {Key, VsnString}), ets:insert(rebar_vsn_cache, {Key, VsnString}),
VsnString VsnString