Skip to content

Commit 1a35a6d

Browse files
authored
Merge pull request #2619 from paulo-ferraz-oliveira/fix/for-utf8
Don't crash on printing non-ASCII characters
2 parents 6091406 + 2d345ed commit 1a35a6d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/rebar_core.erl

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ process_namespace(State, Command) ->
6868
not_found ->
6969
case providers:get_providers_by_namespace(Command, Providers) of
7070
[] ->
71-
{error, io_lib:format("Command ~p not found", [Command])};
71+
{error, io_lib:format("Command ~ts not found", [atom_to_list(Command)])};
7272
_ ->
7373
%% Replay 'do' as a command of that namespace
7474
{ok, rebar_state:namespace(State, Command), do}
@@ -98,10 +98,10 @@ process_command(State, Command) ->
9898
not_found when Command =/= do ->
9999
case Namespace of
100100
default ->
101-
{error, io_lib:format("Command ~p not found", [Command])};
101+
{error, io_lib:format("Command ~ts not found", [atom_to_list(Command)])};
102102
_ ->
103-
{error, io_lib:format("Command ~p not found in namespace ~p",
104-
[Command, Namespace])}
103+
{error, io_lib:format("Command ~ts not found in namespace ~ts",
104+
[atom_to_list(Command), atom_to_list(Namespace)])}
105105
end;
106106
not_found when Command =:= do, Namespace =/= default ->
107107
do([{default, do} | TargetProviders], State);
@@ -120,7 +120,7 @@ process_command(State, Command) ->
120120
State2 = rebar_state:command_parsed_args(State1, Args),
121121
do(TargetProviders, State2);
122122
{error, {invalid_option, Option}} ->
123-
{error, io_lib:format("Invalid option ~ts on task ~p", [Option, Command])};
123+
{error, io_lib:format("Invalid option ~ts on task ~ts", [Option, atom_to_list(Command)])};
124124
{error, {invalid_option_arg, {Option, Arg}}} ->
125125
{error, io_lib:format("Invalid argument ~ts to option ~ts", [Arg, Option])};
126126
{error, {missing_option_arg, Option}} ->
@@ -137,7 +137,7 @@ process_command(State, Command) ->
137137
do([], State) ->
138138
{ok, State};
139139
do([ProviderName | Rest], State) ->
140-
?DEBUG("Running provider: ~p", [friendly_provider(ProviderName)]),
140+
?DEBUG("Running provider: ~tp", [friendly_provider(ProviderName)]),
141141
%% Special providers like 'as', 'do' or some hooks may be passed
142142
%% as a tuple {Namespace, Name}, otherwise not. Handle them
143143
%% on a per-need basis.

src/rebar_state.erl

+3-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,9 @@ add_provider(State=#state_t{providers=Providers, allow_provider_overrides=false}
481481
case lists:any(fun(P) ->
482482
case {providers:impl(P), providers:namespace(P)} of
483483
{Name, Namespace} ->
484-
?DEBUG("Not adding provider ~p ~p from module ~p because it already exists from module ~p",
485-
[Namespace, Name, Module, providers:module(P)]),
484+
?DEBUG("Not adding provider ~ts ~ts from module ~ts because it already exists from module ~ts",
485+
[atom_to_list(Namespace), atom_to_list(Name),
486+
atom_to_list(Module), atom_to_list(providers:module(P))]),
486487
true;
487488
_ ->
488489
false

0 commit comments

Comments
 (0)