summaryrefslogtreecommitdiff
path: root/src/rebar_core.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_core.erl')
-rw-r--r--src/rebar_core.erl62
1 files changed, 39 insertions, 23 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index a53e4f9..14ff754 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -64,35 +64,51 @@ skip_dirs() ->
%% ===================================================================
process_commands([], _ParentConfig) ->
- case erlang:get(operations) of
- 0 ->
- %% none of the commands had an effect
+ AbortTrapped = rebar_config:get_global(abort_trapped, false),
+ case {erlang:get(operations), AbortTrapped} of
+ {0, _} ->
+ %% None of the commands had any effect
+ ?ABORT;
+ {_, true} ->
+ %% An abort was previously trapped
?ABORT;
_ ->
ok
end;
process_commands([Command | Rest], ParentConfig) ->
- %% Reset skip dirs
- lists:foreach(fun (D) -> erlang:erase({skip_dir, D}) end, skip_dirs()),
- Operations = erlang:get(operations),
-
- %% Convert the code path so that all the entries are absolute paths.
- %% If not, code:set_path() may choke on invalid relative paths when trying
- %% to restore the code path from inside a subdirectory.
- true = rebar_utils:expand_code_path(),
- _ = process_dir(rebar_utils:get_cwd(), ParentConfig,
- Command, sets:new()),
- case erlang:get(operations) of
- Operations ->
- %% This command didn't do anything
- ?CONSOLE("Command '~p' not understood or not applicable~n",
- [Command]);
- _ ->
- ok
+ try
+ %% Reset skip dirs
+ lists:foreach(fun (D) -> erlang:erase({skip_dir, D}) end, skip_dirs()),
+ Operations = erlang:get(operations),
+
+ %% Convert the code path so that all the entries are absolute paths.
+ %% If not, code:set_path() may choke on invalid relative paths when trying
+ %% to restore the code path from inside a subdirectory.
+ true = rebar_utils:expand_code_path(),
+ _ = process_dir(rebar_utils:get_cwd(), ParentConfig,
+ Command, sets:new()),
+ case erlang:get(operations) of
+ Operations ->
+ %% This command didn't do anything
+ ?CONSOLE("Command '~p' not understood or not applicable~n",
+ [Command]);
+ _ ->
+ ok
+ end,
+ %% Wipe out vsn cache to avoid invalid hits when
+ %% dependencies are updated
+ ets:delete_all_objects(rebar_vsn_cache)
+ catch
+ throw:rebar_abort ->
+ case rebar_config:get_global(keep_going, false) of
+ false ->
+ ?ABORT;
+ true ->
+ ?WARN("Continuing on after abort: ~p\n", [Rest]),
+ rebar_config:set_global(abort_trapped, true),
+ ok
+ end
end,
- %% Wipe out vsn cache to avoid invalid hits when
- %% dependencies are updated
- ets:delete_all_objects(rebar_vsn_cache),
process_commands(Rest, ParentConfig).