summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/supervisor2.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 773d67d333..5cb2c301b4 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -695,10 +695,13 @@ shutdown(Pid, Time) ->
ok ->
exit(Pid, shutdown), %% Try to shutdown gracefully
receive
- {'DOWN', _MRef, process, Pid, shutdown} ->
- ok;
- {'DOWN', _MRef, process, Pid, OtherReason} ->
- {error, OtherReason}
+ {'DOWN', _MRef, process, Pid, Reason} ->
+ case Reason of
+ normal -> ok;
+ shutdown -> ok;
+ noproc -> ok;
+ _ -> {error, Reason}
+ end
after Time ->
exit(Pid, kill), %% Force termination.
receive
@@ -726,7 +729,12 @@ monitor_child(Pid) ->
{'EXIT', Pid, Reason} ->
receive
{'DOWN', _, process, Pid, _} ->
- {error, Reason}
+ case Reason of
+ normal -> ok;
+ shutdown -> ok;
+ noproc -> ok;
+ _ -> {error, Reason}
+ end
end
after 0 ->
%% If a naughty child did unlink and the child dies before