Puts the standard input and output of the process in a shape the stdio transport can use.
A server on stdio must write JSON-RPC messages to stdout and nothing
else: one log line or one stray IO.puts/1 breaks the protocol of the
client. open/0 returns the two functions the transport takes as its
:read and :write options and prepares the environment: the
encoding of the standard IO device becomes UTF-8, the default handler
of the Logger moves to stderr and the group leader of the calling
process moves to the standard error device, so every process that
starts later writes its stray output to stderr too.
Call it once, first thing, in the process that starts the transport.
Summary
Functions
The function the transport takes as its :read option: one line of
stdin per call, as {:ok, line}, :eof, or {:error, reason}.
Moves the default handler of the Logger to stderr and keeps its
level, formatter and filters. Does nothing when there is no default
handler.
The function the transport takes as its :write option: it writes the
message to stdout, :ok, or {:error, reason} when the write fails.
Functions
The function the transport takes as its :read option: one line of
stdin per call, as {:ok, line}, :eof, or {:error, reason}.
@spec redirect_logger() :: :ok
Moves the default handler of the Logger to stderr and keeps its
level, formatter and filters. Does nothing when there is no default
handler.
The function the transport takes as its :write option: it writes the
message to stdout, :ok, or {:error, reason} when the write fails.