mirror of
https://github.com/correl/rebar.git
synced 2024-11-24 03:00:14 +00:00
Fix Dialyzer warning
This commit is contained in:
parent
1cb1ae238a
commit
317eeb72e0
2 changed files with 12 additions and 7 deletions
|
@ -117,7 +117,6 @@ The following discrepancies are known and safe to ignore:
|
||||||
|
|
||||||
```
|
```
|
||||||
rebar_utils.erl:147: Call to missing or unexported function escript:foldl/3
|
rebar_utils.erl:147: Call to missing or unexported function escript:foldl/3
|
||||||
rebar_utils.erl:180: The created fun has no local return
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It is **strongly recommended** to check the code with
|
It is **strongly recommended** to check the code with
|
||||||
|
|
|
@ -105,7 +105,7 @@ sh(Command0, Options0) ->
|
||||||
case sh_loop(Port, OutputHandler, []) of
|
case sh_loop(Port, OutputHandler, []) of
|
||||||
{ok, _Output} = Ok ->
|
{ok, _Output} = Ok ->
|
||||||
Ok;
|
Ok;
|
||||||
{error, Err} ->
|
{error, {_Rc, _Output}=Err} ->
|
||||||
ErrorHandler(Command, Err)
|
ErrorHandler(Command, Err)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -211,9 +211,7 @@ expand_sh_flag(return_on_error) ->
|
||||||
end};
|
end};
|
||||||
expand_sh_flag({abort_on_error, Message}) ->
|
expand_sh_flag({abort_on_error, Message}) ->
|
||||||
{error_handler,
|
{error_handler,
|
||||||
fun(_Command, _Err) ->
|
log_msg_and_abort(Message)};
|
||||||
?ABORT(Message, [])
|
|
||||||
end};
|
|
||||||
expand_sh_flag(abort_on_error) ->
|
expand_sh_flag(abort_on_error) ->
|
||||||
{error_handler,
|
{error_handler,
|
||||||
fun log_and_abort/2};
|
fun log_and_abort/2};
|
||||||
|
@ -233,9 +231,17 @@ expand_sh_flag({cd, _CdArg} = Cd) ->
|
||||||
expand_sh_flag({env, _EnvArg} = Env) ->
|
expand_sh_flag({env, _EnvArg} = Env) ->
|
||||||
{port_settings, Env}.
|
{port_settings, Env}.
|
||||||
|
|
||||||
-spec log_and_abort(string(), integer()) -> no_return().
|
-type err_handler() :: fun((string(), {integer(), string()}) -> no_return()).
|
||||||
|
-spec log_msg_and_abort(string()) -> err_handler().
|
||||||
|
log_msg_and_abort(Message) ->
|
||||||
|
fun(_Command, {_Rc, _Output}) ->
|
||||||
|
?ABORT(Message, [])
|
||||||
|
end.
|
||||||
|
|
||||||
|
-spec log_and_abort(string(), {integer(), string()}) -> no_return().
|
||||||
log_and_abort(Command, {Rc, Output}) ->
|
log_and_abort(Command, {Rc, Output}) ->
|
||||||
?ABORT("~s failed with error: ~w and output:~n~s~n", [Command, Rc, Output]).
|
?ABORT("~s failed with error: ~w and output:~n~s~n",
|
||||||
|
[Command, Rc, Output]).
|
||||||
|
|
||||||
sh_loop(Port, Fun, Acc) ->
|
sh_loop(Port, Fun, Acc) ->
|
||||||
receive
|
receive
|
||||||
|
|
Loading…
Reference in a new issue