aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/ssh/test/ssh_test_lib.erl53
1 files changed, 42 insertions, 11 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index c6541461a1..a1291146e4 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -655,17 +655,48 @@ sshc(Tag) ->
).
ssh_type() ->
- case os:find_executable("ssh") of
- false -> not_found;
- _ ->
- case os:cmd("ssh -V") of
- "OpenSSH" ++ _ ->
- openSSH;
- Str ->
- ct:log("ssh client ~p is unknown",[Str]),
- unknown
- end
- end.
+ Parent = self(),
+ Pid = spawn(fun() ->
+ Parent ! {ssh_type,self(),ssh_type1()}
+ end),
+ MonitorRef = monitor(process, Pid),
+ receive
+ {ssh_type, Pid, Result} ->
+ demonitor(MonitorRef),
+ Result;
+ {'DOWN', MonitorRef, process, Pid, _Info} ->
+ ct:log("~p:~p Process DOWN",[?MODULE,?LINE]),
+ not_found
+ after
+ 10000 ->
+ ct:log("~p:~p Timeout",[?MODULE,?LINE]),
+ demonitor(MonitorRef),
+ not_found
+ end.
+
+
+ssh_type1() ->
+ try
+ case os:find_executable("ssh") of
+ false ->
+ ct:log("~p:~p Executable \"ssh\" not found",[?MODULE,?LINE]),
+ not_found;
+ _ ->
+ case os:cmd("ssh -V") of
+ "OpenSSH" ++ _ ->
+ openSSH;
+ Str ->
+ ct:log("ssh client ~p is unknown",[Str]),
+ unknown
+ end
+ end
+ catch
+ Class:Exception ->
+ ct:log("~p:~p Exception ~p:~p",[?MODULE,?LINE,Class,Exception]),
+ not_found
+ end.
+
+
algo_intersection([], _) -> [];
algo_intersection(_, []) -> [];