From e0101c91b82428a8aaacf64f4c696e41a34f5523 Mon Sep 17 00:00:00 2001 From: preciz Date: Sun, 8 Nov 2026 13:16:32 +0100 Subject: [PATCH] Correct Process.spawn monitor options in typespecs and documentation Assisted-by: Codex CLI:GPT 6.1 Sol --- lib/elixir/lib/process.ex | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/elixir/lib/process.ex b/lib/elixir/lib/process.ex index 4242aab6807..9b341b18ff8 100644 --- a/lib/elixir/lib/process.ex +++ b/lib/elixir/lib/process.ex @@ -472,7 +472,7 @@ defmodule Process do @type spawn_opt :: :link | :monitor - | {:monitor, :erlang.monitor_option()} + | {:monitor, [:erlang.monitor_option()]} | {:priority, :low | :normal | :high} | {:fullsweep_after, non_neg_integer} | {:min_heap_size, non_neg_integer} @@ -484,10 +484,10 @@ defmodule Process do @doc """ Spawns the given function according to the given options. - The result depends on the given options. In particular, - if `:monitor` is given as an option, it will return a tuple - containing the PID and the monitoring reference, otherwise - just the spawned process PID. + The result depends on the given options. If `:monitor` or + `{:monitor, monitor_opts}` is given, returns a tuple containing + the PID and the monitoring reference. Otherwise, returns + only the spawned process PID. More options are available; for the comprehensive list of available options check `:erlang.spawn_opt/4`. @@ -509,10 +509,10 @@ defmodule Process do Spawns the given function `fun` from module `mod`, passing the given `args` according to the given options. - The result depends on the given options. In particular, - if `:monitor` is given as an option, it will return a tuple - containing the PID and the monitoring reference, otherwise - just the spawned process PID. + The result depends on the given options. If `:monitor` or + `{:monitor, monitor_opts}` is given, returns a tuple containing + the PID and the monitoring reference. Otherwise, returns + only the spawned process PID. It also accepts extra options, for the list of available options check `:erlang.spawn_opt/4`.