Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions lib/kernel/src/group.erl
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,26 @@ init(internal, [Shell, Options], State = #state{ dumb = Dumb }) ->

-spec whereis_shell() -> undefined | pid().
whereis_shell() ->
case node(group_leader()) of
GroupLeaderPid = group_leader(),
case node(GroupLeaderPid) of
Node when Node =:= node() ->
case user_drv:whereis_group() of
undefined -> undefined;
GroupPid ->
{dictionary, Dict} = erlang:process_info(GroupPid, dictionary),
proplists:get_value(shell, Dict)
Key = {dictionary, shell},
maybe
{Key, GroupLeaderShellPid} ?= erlang:process_info(GroupLeaderPid, Key),
true ?= is_pid(GroupLeaderShellPid),
GroupLeaderShellPid
else
_ ->
maybe
GroupPid ?= user_drv:whereis_group(),
true ?= is_pid(GroupPid),
{Key, GroupShellPid} ?= erlang:process_info(GroupPid, Key),
true ?= is_pid(GroupShellPid),
GroupShellPid
else
_ ->
undefined
end
end;
OtherNode ->
erpc:call(OtherNode, group, whereis_shell, [])
Expand Down
Loading