diff options
author | Dan Gudmundsson <[email protected]> | 2017-08-22 14:43:54 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-09-15 17:07:51 +0200 |
commit | a3624ab24535458b13abb7e314ed7dfbe3da09ba (patch) | |
tree | 703f36f9d93a2e4037c10392deb30c477bd6d42c /erts/test/z_SUITE.erl | |
parent | 0f397e8c97a556169bac7cc95b6bb98ccd16bf66 (diff) | |
download | otp-a3624ab24535458b13abb7e314ed7dfbe3da09ba.tar.gz otp-a3624ab24535458b13abb7e314ed7dfbe3da09ba.tar.bz2 otp-a3624ab24535458b13abb7e314ed7dfbe3da09ba.zip |
system (test): Do not use deprecated functions in string(3)
Diffstat (limited to 'erts/test/z_SUITE.erl')
-rw-r--r-- | erts/test/z_SUITE.erl | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl index d474c71c4f..cd7a894eb5 100644 --- a/erts/test/z_SUITE.erl +++ b/erts/test/z_SUITE.erl @@ -132,22 +132,9 @@ core_search_conf(RunByTS, DBTop, XDir) -> file_inspect(#core_search_conf{file = File}, Core) -> FRes0 = os:cmd(File ++ " " ++ Core), - FRes = case string:str(FRes0, Core) of - 0 -> - FRes0; - S -> - L = length(FRes0), - E = length(Core), - case S of - 1 -> - lists:sublist(FRes0, E+1, L+1); - _ -> - lists:sublist(FRes0, 1, S-1) - ++ - " " - ++ - lists:sublist(FRes0, E+1, L+1) - end + FRes = case string:split(FRes0, Core) of + [S1] -> S1; + [S1,S2] -> lists:flatten(S1 ++ " " ++ S2) end, case re:run(FRes, "text|ascii", [caseless,{capture,none}]) of match -> @@ -194,9 +181,6 @@ mod_time_list(F) -> [0,0,0,0,0,0] end. -str_strip(S) -> - string:strip(string:strip(string:strip(S), both, $\n), both, $\r). - dump_core(#core_search_conf{ cerl = false }, _) -> ok; dump_core(_, {ignore, _Core}) -> @@ -232,7 +216,7 @@ format_core(#core_search_conf{file = false}, Core, Ignore) -> io:format(" ~s~s " ++ time_fstr() ++ "~s~n", [Ignore, Core] ++ mod_time_list(Core)); format_core(#core_search_conf{file = File}, Core, Ignore) -> - FRes = str_strip(os:cmd(File ++ " " ++ Core)), + FRes = string:trim(os:cmd(File ++ " " ++ Core)), case catch re:run(FRes, Core, [caseless,{capture,none}]) of match -> io:format(" ~s~s " ++ time_fstr() ++ "~n", |