diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-10-13 11:57:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-13 11:57:43 -0400 |
commit | 0e15a4cf22b50e4df2100052a332205aeba98972 (patch) | |
tree | a3cac95897747b57f8c16dfb59406c87e868dd41 /src/rebar_prv_unlock.erl | |
parent | 5aba7df926d0bd60ed2beddddec51622b5740e37 (diff) | |
parent | e592573745ee5dbc337d77997aaa8ebb40b566bb (diff) |
Merge pull request #1647 from ferd/fix-unlock-state-carry
Fix unlock state carry, which broke `do` sequences with `unlock` in them.
Diffstat (limited to 'src/rebar_prv_unlock.erl')
-rw-r--r-- | src/rebar_prv_unlock.erl | 13 |
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) -> |