aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/nodetool
diff options
context:
space:
mode:
authorLuis Rascão <[email protected]>2017-11-11 02:01:51 +0000
committerGitHub <[email protected]>2017-11-11 02:01:51 +0000
commit1d051663982502620dbdd2b372aee52894981568 (patch)
tree5859cfa77aeca68f30c03ceec8ee31cd2d3e943c /priv/templates/nodetool
parentfb91587091ad8a9da7c22598e962d0f21dcc17ee (diff)
parent2868d7a7ae79829c740ff9a49e22e2ccf9e6296c (diff)
downloadrelx-1d051663982502620dbdd2b372aee52894981568.tar.gz
relx-1d051663982502620dbdd2b372aee52894981568.tar.bz2
relx-1d051663982502620dbdd2b372aee52894981568.zip
Merge pull request #618 from ferd/otp-20-unicode-support
OTP-20 unicode support and OTP-21 readiness
Diffstat (limited to 'priv/templates/nodetool')
-rw-r--r--priv/templates/nodetool18
1 files changed, 14 insertions, 4 deletions
diff --git a/priv/templates/nodetool b/priv/templates/nodetool
index 1f409f5..816be9c 100644
--- a/priv/templates/nodetool
+++ b/priv/templates/nodetool
@@ -57,7 +57,7 @@ main(Args) ->
% spaces, so this converts all of that to a single string to parse
String = binary_to_list(
list_to_binary(
- string:join(ListOfArgs," ")
+ join(ListOfArgs," ")
)
),
@@ -126,16 +126,16 @@ epmd_path() ->
nodename(Name) ->
- case string:tokens(Name, "@") of
+ case re:split(Name, "@", [{return, list}, unicode]) of
[_Node, _Host] ->
list_to_atom(Name);
[Node] ->
- [_, Host] = string:tokens(atom_to_list(node()), "@"),
+ [_, Host] = re:split(atom_to_list(node()), "@", [{return, list}, unicode]),
list_to_atom(lists:concat([Node, "@", Host]))
end.
append_node_suffix(Name, Suffix) ->
- case string:tokens(Name, "@") of
+ case re:split(Name, "@", [{return, list}, unicode]) of
[Node, Host] ->
list_to_atom(lists:concat([Node, Suffix, os:getpid(), "@", Host]));
[Node] ->
@@ -165,3 +165,13 @@ consult(Cont, Str, Acc) ->
{more, Cont1} ->
consult(Cont1, eof, Acc)
end.
+
+%% string:join/2 copy; string:join/2 is getting obsoleted
+%% and replaced by lists:join/2, but lists:join/2 is too new
+%% for version support (only appeared in 19.0) so it cannot be
+%% used. Instead we just adopt join/2 locally and hope it works
+%% for most unicode use cases anyway.
+join([], Sep) when is_list(Sep) ->
+ [];
+join([H|T], Sep) ->
+ H ++ lists:append([Sep ++ X || X <- T]).