Skip to content

Commit fb4dd54

Browse files
Expose getting specific process dictionary keys in Process.info/2 (#13505)
This functionality is present since OTP 26.2: erlang/otp#7707
1 parent 6863a51 commit fb4dd54

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/elixir/lib/process.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,13 +839,17 @@ defmodule Process do
839839
nilify(:erlang.process_info(pid))
840840
end
841841

842+
@type process_info_item :: atom | {:dictionary, term}
843+
@type process_info_result_item :: {process_info_item, term}
844+
842845
@doc """
843846
Returns information about the process identified by `pid`,
844847
or returns `nil` if the process is not alive.
845848
846849
See `:erlang.process_info/2` for more information.
847850
"""
848-
@spec info(pid, atom | [atom]) :: {atom, term} | [{atom, term}] | nil
851+
@spec info(pid, process_info_item) :: process_info_result_item | nil
852+
@spec info(pid, [process_info_item]) :: [process_info_result_item] | nil
849853
def info(pid, spec)
850854

851855
def info(pid, :registered_name) do
@@ -856,7 +860,7 @@ defmodule Process do
856860
end
857861
end
858862

859-
def info(pid, spec) when is_atom(spec) or is_list(spec) do
863+
def info(pid, spec) do
860864
nilify(:erlang.process_info(pid, spec))
861865
end
862866

0 commit comments

Comments
 (0)