Преглед на файлове

Handle custom logger shell breakage

When swapping handlers, if a custom shell has been installed, it's
possible it'll take over the tty and other options. This may break
common operations that work on an otherwise regular shell, so we ignore
failures and let things work with the custom shell only.
pull/499/head
Fred Hebert преди 10 години
родител
ревизия
5c78f96c41
променени са 1 файла, в които са добавени 12 реда и са изтрити 6 реда
  1. +12
    -6
      src/rebar_prv_shell.erl

+ 12
- 6
src/rebar_prv_shell.erl Целия файл

@ -111,12 +111,18 @@ setup_shell() ->
%% liveness check. %% liveness check.
_ = [catch erlang:group_leader(whereis(user), Pid) || Pid <- NeedsUpdate, _ = [catch erlang:group_leader(whereis(user), Pid) || Pid <- NeedsUpdate,
is_process_alive(Pid)], is_process_alive(Pid)],
%% enable error_logger's tty output
ok = error_logger:swap_handler(tty),
%% disable the simple error_logger (which may have been added multiple
%% times). removes at most the error_logger added by init and the
%% error_logger added by the tty handler
ok = remove_error_handler(3).
try
%% enable error_logger's tty output
error_logger:swap_handler(tty),
%% disable the simple error_logger (which may have been added multiple
%% times). removes at most the error_logger added by init and the
%% error_logger added by the tty handler
remove_error_handler(3)
catch
E:R -> % may fail with custom loggers
?DEBUG("Logger changes failed for ~p:~p (~p)", [E,R,erlang:get_stacktrace()]),
hope_for_best
end.
setup_paths(State) -> setup_paths(State) ->
%% Add deps to path %% Add deps to path

Зареждане…
Отказ
Запис