From 2fabfe1ee824e3d1d0764e2770309c242ae771d9 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Thu, 28 May 2015 02:16:12 +0000 Subject: '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. --- src/rebar_prv_do.erl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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} -> -- cgit v1.1