Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash on printing non-ASCII characters #2619

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/rebar_core.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ process_namespace(State, Command) ->
not_found ->
case providers:get_providers_by_namespace(Command, Providers) of
[] ->
{error, io_lib:format("Command ~p not found", [Command])};
{error, io_lib:format("Command ~ts not found", [atom_to_list(Command)])};
_ ->
%% Replay 'do' as a command of that namespace
{ok, rebar_state:namespace(State, Command), do}
Expand Down Expand Up @@ -98,10 +98,10 @@ process_command(State, Command) ->
not_found when Command =/= do ->
case Namespace of
default ->
{error, io_lib:format("Command ~p not found", [Command])};
{error, io_lib:format("Command ~ts not found", [atom_to_list(Command)])};
_ ->
{error, io_lib:format("Command ~p not found in namespace ~p",
[Command, Namespace])}
{error, io_lib:format("Command ~ts not found in namespace ~ts",
[atom_to_list(Command), atom_to_list(Namespace)])}
end;
not_found when Command =:= do, Namespace =/= default ->
do([{default, do} | TargetProviders], State);
Expand All @@ -120,7 +120,7 @@ process_command(State, Command) ->
State2 = rebar_state:command_parsed_args(State1, Args),
do(TargetProviders, State2);
{error, {invalid_option, Option}} ->
{error, io_lib:format("Invalid option ~ts on task ~p", [Option, Command])};
{error, io_lib:format("Invalid option ~ts on task ~ts", [Option, atom_to_list(Command)])};
{error, {invalid_option_arg, {Option, Arg}}} ->
{error, io_lib:format("Invalid argument ~ts to option ~ts", [Arg, Option])};
{error, {missing_option_arg, Option}} ->
Expand All @@ -137,7 +137,7 @@ process_command(State, Command) ->
do([], State) ->
{ok, State};
do([ProviderName | Rest], State) ->
?DEBUG("Running provider: ~p", [friendly_provider(ProviderName)]),
?DEBUG("Running provider: ~tp", [friendly_provider(ProviderName)]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ~ts or ~tp?

%% Special providers like 'as', 'do' or some hooks may be passed
%% as a tuple {Namespace, Name}, otherwise not. Handle them
%% on a per-need basis.
Expand Down
5 changes: 3 additions & 2 deletions src/rebar_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,9 @@ add_provider(State=#state_t{providers=Providers, allow_provider_overrides=false}
case lists:any(fun(P) ->
case {providers:impl(P), providers:namespace(P)} of
{Name, Namespace} ->
?DEBUG("Not adding provider ~p ~p from module ~p because it already exists from module ~p",
[Namespace, Name, Module, providers:module(P)]),
?DEBUG("Not adding provider ~ts ~ts from module ~ts because it already exists from module ~ts",
[atom_to_list(Namespace), atom_to_list(Name),
atom_to_list(Module), atom_to_list(providers:module(P))]),
true;
_ ->
false
Expand Down