Explorar el Código

Fixing the carry of unlocks

When composed with 'do', not carrying the unlocks in state may create
problems.
pull/1647/head
Fred Hebert hace 7 años
padre
commit
73fc54235f
Se han modificado 1 ficheros con 8 adiciones y 5 borrados
  1. +8
    -5
      src/rebar_prv_unlock.erl

+ 8
- 5
src/rebar_prv_unlock.erl Ver fichero

@ -49,8 +49,8 @@ do(State) ->
{ok, _} -> {ok, _} ->
Locks = rebar_config:consult_lock_file(LockFile), Locks = rebar_config:consult_lock_file(LockFile),
case handle_unlocks(State, Locks, LockFile) of case handle_unlocks(State, Locks, LockFile) of
ok ->
{ok, State};
{ok, NewLocks} ->
{ok, rebar_state:set(State, {locks, default}, NewLocks)};
{error, Reason} -> {error, Reason} ->
?PRV_ERROR({file,Reason}) ?PRV_ERROR({file,Reason})
end end
@ -69,11 +69,14 @@ handle_unlocks(State, Locks, LockFile) ->
Names = parse_names(rebar_utils:to_binary(proplists:get_value(package, Args, <<"">>))), Names = parse_names(rebar_utils:to_binary(proplists:get_value(package, Args, <<"">>))),
case [Lock || Lock = {Name, _, _} <- Locks, not lists:member(Name, Names)] of case [Lock || Lock = {Name, _, _} <- Locks, not lists:member(Name, Names)] of
[] -> [] ->
file:delete(LockFile);
file:delete(LockFile),
{ok, []};
_ when Names =:= [] -> % implicitly all locks _ when Names =:= [] -> % implicitly all locks
file:delete(LockFile);
file:delete(LockFile),
{ok, []};
NewLocks -> NewLocks ->
rebar_config:write_lock_file(LockFile, NewLocks)
rebar_config:write_lock_file(LockFile, NewLocks),
{ok, NewLocks}
end. end.
parse_names(Bin) -> parse_names(Bin) ->

Cargando…
Cancelar
Guardar