summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-01-18 19:16:21 -0500
committerFred Hebert <mononcqc@ferd.ca>2015-01-18 19:16:21 -0500
commit5528007751fa534a320c27f46552c15b3ec3028d (patch)
tree64102f90c1001ed2a9ec9dc7ce33843b36d00cb7
parent902edde6e8d4cb7689a120f5ae72eaed531b0664 (diff)
parentfe4a10141baa00e33e0c6f04f2a67b80107729b7 (diff)
Merge pull request #105 from tsloughter/master
do provider returns the error of the first provider to fail and stops
-rw-r--r--src/rebar_prv_do.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/rebar_prv_do.erl b/src/rebar_prv_do.erl
index c2bbe2b..5dec7d8 100644
--- a/src/rebar_prv_do.erl
+++ b/src/rebar_prv_do.erl
@@ -33,13 +33,21 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
Tasks = args_to_tasks(rebar_state:command_args(State)),
- lists:foldl(fun(TaskArgs, {ok, StateAcc}) ->
- [TaskStr | Args] = string:tokens(TaskArgs, " "),
- Task = list_to_atom(TaskStr),
- StateAcc1 = rebar_state:set(StateAcc, task, Task),
- StateAcc2 = rebar_state:command_args(StateAcc1, Args),
- rebar_core:process_command(StateAcc2, Task)
- end, {ok, State}, Tasks).
+ do_tasks(Tasks, State).
+
+do_tasks([], State) ->
+ {ok, State};
+do_tasks([TaskArgs | Tail], State) ->
+ [TaskStr | Args] = string:tokens(TaskArgs, " "),
+ Task = list_to_atom(TaskStr),
+ State1 = rebar_state:set(State, task, Task),
+ State2 = rebar_state:command_args(State1, Args),
+ case rebar_core:process_command(State2, Task) of
+ {ok, State3} ->
+ do_tasks(Tail, State3);
+ Error ->
+ Error
+ end.
-spec format_error(any()) -> iolist().
format_error(Reason) ->