aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_connection_sup.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-08-28 11:09:08 +0200
committerIngela Anderton Andin <[email protected]>2012-08-28 11:09:08 +0200
commitb9a7003314280a22ea145758542b6a96c75a139a (patch)
treee35f39dff6dcd1af3ca2ab2ca58d429f9d9bc0a2 /lib/ssh/src/ssh_connection_sup.erl
parent3a354d40ed3ef0604e1caf78f8995e01de3c8b89 (diff)
downloadotp-b9a7003314280a22ea145758542b6a96c75a139a.tar.gz
otp-b9a7003314280a22ea145758542b6a96c75a139a.tar.bz2
otp-b9a7003314280a22ea145758542b6a96c75a139a.zip
ssh: Correct error handling of ssh connect
Diffstat (limited to 'lib/ssh/src/ssh_connection_sup.erl')
-rw-r--r--lib/ssh/src/ssh_connection_sup.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_sup.erl b/lib/ssh/src/ssh_connection_sup.erl
index e3544af1c6..b620056310 100644
--- a/lib/ssh/src/ssh_connection_sup.erl
+++ b/lib/ssh/src/ssh_connection_sup.erl
@@ -48,8 +48,12 @@ start_manager_child(Sup, Args) ->
supervisor:start_child(Sup, Spec).
connection_manager(SupPid) ->
- Children = supervisor:which_children(SupPid),
- {ok, ssh_connection_manager(Children)}.
+ try supervisor:which_children(SupPid) of
+ Children ->
+ {ok, ssh_connection_manager(Children)}
+ catch exit:{noproc,_} ->
+ {ok, undefined}
+ end.
%%%=========================================================================
%%% Supervisor callback
@@ -107,6 +111,8 @@ handler_spec([Role, Socket, Opts]) ->
Type = worker,
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
+ssh_connection_manager([]) ->
+ undefined;
ssh_connection_manager([{_, Child, _, [ssh_connection_manager]} | _]) ->
Child;
ssh_connection_manager([_ | Rest]) ->