summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2018-05-03 18:14:11 -0400
committerGitHub <noreply@github.com>2018-05-03 18:14:11 -0400
commit048dfad1e8e05aead68cdd062653d8f51d2eaf88 (patch)
tree5157ad3d51aa3765df04a226206441a07e95974f /src/rebar_utils.erl
parenta908284b112ff77dbf0ae9b9f946bc7b739faf29 (diff)
parente321ca64981504f10a3be1715ce5d94c3cd10ae7 (diff)
Merge pull request #1773 from ferd/otp-21-stacktrace-compat
Work around OTP-21 deprecation of get_stacktrace() and other incompatible changes
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index a911cc2..604abb8 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -506,11 +506,10 @@ otp_release1(Rel) ->
%% It's fine to rely on the binary module here because we can
%% be sure that it's available when the otp_release string does
%% not begin with $R.
- Size = byte_size(Vsn),
%% The shortest vsn string consists of at least two digits
%% followed by "\n". Therefore, it's safe to assume Size >= 3.
- case binary:part(Vsn, {Size, -3}) of
- <<"**\n">> ->
+ case binary:match(Vsn, <<"**">>) of
+ {Pos, _} ->
%% The OTP documentation mentions that a system patched
%% using the otp_patch_apply tool available to licensed
%% customers will leave a '**' suffix in the version as a
@@ -519,9 +518,9 @@ otp_release1(Rel) ->
%% drop the suffix, given for all intents and purposes, we
%% cannot obtain relevant information from it as far as
%% tooling is concerned.
- binary:bin_to_list(Vsn, {0, Size - 3});
- _ ->
- binary:bin_to_list(Vsn, {0, Size - 1})
+ binary:bin_to_list(Vsn, {0, Pos});
+ nomatch ->
+ rebar_string:trim(binary:bin_to_list(Vsn), trailing, "\n")
end
end.