summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-05-28 02:16:12 +0000
committerFred Hebert <mononcqc@ferd.ca>2015-05-28 02:16:12 +0000
commit2fabfe1ee824e3d1d0764e2770309c242ae771d9 (patch)
tree9f8e9ea0b0dc41a4f250a8d82e59449be897676a
parent51e822e54cf862e3026d23a1f9e74797c4e7f9eb (diff)
'do' returns its final state.
While 'do' skips state updates between subcommands so that: rebar3 do a, b == (rebar3 a && rebar3 b) The final state of 'b' does not need to be discarded and might in fact be useful to get when dealing with Rebar3 as an API. This can be done without breaking the equality relation already established.
-rw-r--r--src/rebar_prv_do.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rebar_prv_do.erl b/src/rebar_prv_do.erl
index aee3a27..29ef054 100644
--- a/src/rebar_prv_do.erl
+++ b/src/rebar_prv_do.erl
@@ -47,6 +47,8 @@ do_tasks([{TaskStr, Args}|Tail], State) ->
default ->
%% The first task we hit might be a namespace!
case maybe_namespace(State2, Task, Args) of
+ {ok, FinalState} when Tail =:= [] ->
+ {ok, FinalState};
{ok, _} ->
do_tasks(Tail, State);
{error, Reason} ->
@@ -56,6 +58,8 @@ do_tasks([{TaskStr, Args}|Tail], State) ->
%% We're already in a non-default namespace, check the
%% task directly.
case rebar_core:process_command(State2, Task) of
+ {ok, FinalState} when Tail =:= [] ->
+ {ok, FinalState};
{ok, _} ->
do_tasks(Tail, State);
{error, Reason} ->