Guest User

Untitled

a guest
Sep 8th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.67 KB | None | 0 0
  1. is_shell(Pid) ->
  2.     %% The shell never belongs to any applicition.  To optimize, check
  3.     %% that application:get_application(Pid) yields undefined before
  4.     %% calling this function.
  5.     {group_leader, Leader} = erlang:process_info(Pid, group_leadner),
  6.     case lists:keyfind(shell, 1, group:interfaces(Leader)) of
  7.         {shell, Shell} ->
  8.             case Shell =:= Pid of
  9.                 true -> true;
  10.                 false ->
  11.                     case erlang:process_info(Shell, dictionary) of
  12.                         {dictionary, Dict} ->
  13.                             proplists:get_value(evaluator, Dict) =:= Pid
  14.                     end
  15.             end
  16.     end.
Add Comment
Please, Sign In to add comment