summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2017-10-13 10:19:14 -0400
committerFred Hebert <mononcqc@ferd.ca>2017-10-13 10:19:14 -0400
commit73fc54235f6b3cec5201e23c7baee4c5086ac2b1 (patch)
tree5e8d2dd5ade8b9568c5bcb4812aab31e79444a1d
parent6d9037a5a4d9d6480ca061f47da62c66a5fbc16c (diff)
Fixing the carry of unlocks
When composed with 'do', not carrying the unlocks in state may create problems.
-rw-r--r--src/rebar_prv_unlock.erl13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rebar_prv_unlock.erl b/src/rebar_prv_unlock.erl
index 51c57ab..8480991 100644
--- a/src/rebar_prv_unlock.erl
+++ b/src/rebar_prv_unlock.erl
@@ -49,8 +49,8 @@ do(State) ->
{ok, _} ->
Locks = rebar_config:consult_lock_file(LockFile),
case handle_unlocks(State, Locks, LockFile) of
- ok ->
- {ok, State};
+ {ok, NewLocks} ->
+ {ok, rebar_state:set(State, {locks, default}, NewLocks)};
{error, Reason} ->
?PRV_ERROR({file,Reason})
end
@@ -69,11 +69,14 @@ handle_unlocks(State, Locks, LockFile) ->
Names = parse_names(rebar_utils:to_binary(proplists:get_value(package, Args, <<"">>))),
case [Lock || Lock = {Name, _, _} <- Locks, not lists:member(Name, Names)] of
[] ->
- file:delete(LockFile);
+ file:delete(LockFile),
+ {ok, []};
_ when Names =:= [] -> % implicitly all locks
- file:delete(LockFile);
+ file:delete(LockFile),
+ {ok, []};
NewLocks ->
- rebar_config:write_lock_file(LockFile, NewLocks)
+ rebar_config:write_lock_file(LockFile, NewLocks),
+ {ok, NewLocks}
end.
parse_names(Bin) ->