summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2021-02-16 15:36:20 +0100
committerHans Nilsson <hans@erlang.org>2021-02-19 10:32:55 +0100
commitb6974c0f4cf19910c100cc50dfab74adeddf6f25 (patch)
tree436de2177fdbd0d6e17d8c0190efe420f836355e
parentbff279aa187ee891ac44ea01ae256d9b3cfdc46e (diff)
downloaderlang-b6974c0f4cf19910c100cc50dfab74adeddf6f25.tar.gz
ssh: Fix crash of controller
if the supervisor it tries to kill is already dead.
-rw-r--r--lib/ssh/src/ssh_controller.erl16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/ssh/src/ssh_controller.erl b/lib/ssh/src/ssh_controller.erl
index 4b8f5a7e8e..d8fbc8d0f2 100644
--- a/lib/ssh/src/ssh_controller.erl
+++ b/lib/ssh/src/ssh_controller.erl
@@ -104,11 +104,17 @@ handle_call({start_system_subsystem, Sup, Address, Port, Profile, Options, Child
handle_call({stop_system,SysSup}, _From, D) ->
- case supervisor:which_children(SysSup) of
- [] ->
- ssh_system_sup:stop_system(D#data.role, SysSup);
- _X ->
- ok
+ try
+ case supervisor:which_children(SysSup) of
+ [] ->
+ ssh_system_sup:stop_system(D#data.role, SysSup);
+ _X ->
+ ok
+ end
+ catch
+ _:_ ->
+ %% Already stopped (?)
+ skip
end,
{reply, ok, D}.