Skip to content

Expose getting process dictionary value for specific key in Process.info/2 #13505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
8 changes: 6 additions & 2 deletions lib/elixir/lib/process.ex
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,17 @@ defmodule Process do
nilify(:erlang.process_info(pid))
end

@type process_info_item :: atom | {:dictionary, term}
@type process_info_result_item :: {process_info_item, term}

@doc """
Returns information about the process identified by `pid`,
or returns `nil` if the process is not alive.

See `:erlang.process_info/2` for more information.
"""
@spec info(pid, atom | [atom]) :: {atom, term} | [{atom, term}] | nil
@spec info(pid, process_info_item) :: process_info_result_item | nil
@spec info(pid, [process_info_item]) :: [process_info_result_item] | nil
def info(pid, spec)

def info(pid, :registered_name) do
Expand All @@ -856,7 +860,7 @@ defmodule Process do
end
end

def info(pid, spec) when is_atom(spec) or is_list(spec) do
def info(pid, spec) do
nilify(:erlang.process_info(pid, spec))
end

Expand Down