Skip to content

Commit

Permalink
Merge pull request #2619 from paulo-ferraz-oliveira/fix/for-utf8
Browse files Browse the repository at this point in the history
Don't crash on printing non-ASCII characters
  • Loading branch information
ferd authored Sep 27, 2021
2 parents 6091406 + 2d345ed commit 1a35a6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
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)]),
%% 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

0 comments on commit 1a35a6d

Please sign in to comment.