File 0459-stdlib-Expand-io-docs-to-show-that-standard_io-is-gr.patch of Package erlang
From 43f5e79f2ab72ff9d1dad8bec5a0f6b4b42606c5 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Tue, 18 May 2021 13:25:37 +0200
Subject: [PATCH 3/6] stdlib: Expand io docs to show that standard_io is group
leader
This was previously not documented, but it is mentioned in a lot of
places that it is the group leader that all I/O is sent to by default.
So we can just as well make it explicit that standard_io is just an
alias for group_leader() and thus the target of standard_io is changed
when the group leader is changed.
---
lib/stdlib/doc/src/io.xml | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml
index 9fd87d9cf1..99871c280b 100644
--- a/lib/stdlib/doc/src/io.xml
+++ b/lib/stdlib/doc/src/io.xml
@@ -36,10 +36,12 @@
or exit if they are not.</p>
<p>All functions in this module have an optional
- parameter <c>IoDevice</c>. If included, it must be the pid of a
- process that handles the I/O protocols. Normally, it is the
- <c>IoDevice</c> returned by
- <seemfa marker="kernel:file#open/2"><c>file:open/2</c></seemfa>.</p>
+ parameter <seetype marker="#device"><c>IoDevice</c></seetype>.
+ If included, it must be the pid of a process that handles the I/O
+ protocols. Normally, it is a <c>IoDevice</c> returned by
+ <seemfa marker="kernel:file#open/2"><c>file:open/2</c></seemfa>.
+ If no <seetype marker="#device"><c>IoDevice</c></seetype> is given,
+ <c>standard_io</c> is used.</p>
<p>For a description of the I/O protocols, see section
<seeguide marker="io_protocol">The Erlang I/O Protocol</seeguide>
@@ -71,7 +73,10 @@
<desc>
<p>An I/O device, either <c>standard_io</c>, <c>standard_error</c>, a
registered name, or a pid handling I/O protocols (returned from
- <seemfa marker="kernel:file#open/2"><c>file:open/2</c></seemfa>).
+ <seemfa marker="kernel:file#open/2"><c>file:open/2</c></seemfa>).</p>
+ <p>For more information about the built-in devices see
+ <seeerl marker="#standard-input-output">Standard Input/Output</seeerl>
+ and <seeerl marker="#standard-error">Standard Error</seeerl>.
</p>
</desc>
</datatype>
@@ -1227,6 +1232,12 @@ enter><input>foo.</input>
enter><input>bar.</input>
{ok,bar}</pre>
+ <p><c>standard_io</c> is an alias for <seemfa marker="erts:erlang#group_leader/0"><c>
+ group_leader/0</c></seemfa>, so in order to change where the default input/output
+ requests are sent you can change the group leader using
+ <seemfa marker="erts:erlang#group_leader/2"><c>
+ group_leader(self(), NewGroupLeader).</c></seemfa></p>
+
<p>There is always a process registered under the name of
<c>user</c>. This can be used for sending output to the user.</p>
</section>
--
2.26.2