@@ -89,21 +89,30 @@ or when [`erl`](`e:erts:erl_cmd.md`) is started with the
8989[ ` -noshell ` ] ( `e:erts:erl_cmd.md#noshell` ) flags. The following options are
9090allowed:
9191
92- - ** noshell | {noshell, Mode}** {: #noshell_raw } - Starts the interactive shell
93- as if [ ` -noshell ` ] ( `e:erts:erl_cmd.md#noshell` ) was given to
92+ - ** noshell | {noshell, Mode}** {: #noshell_raw } - Starts the interactive
93+ shell as if [ ` -noshell ` ] ( `e:erts:erl_cmd.md#noshell` ) was given to
9494 [ ` erl ` ] ( `e:erts:erl_cmd.md` ) .
9595
96- It is possible to give a ` Mode ` indicating if the input should be set
97- in ` cooked ` or ` raw ` mode. ` Mode ` only has en effect if ` t:io:user/0 ` is a tty.
98- If no ` Mode ` is given, it defaults is ` cooked ` .
96+ ` Mode ` is either the atom ` cooked ` or ` raw ` , or a map with the
97+ following keys:
9998
100- When in ` raw ` mode all key presses are passed to ` t:io:user/0 ` as they are
101- typed when they are typed and the characters are not echoed to the terminal.
102- It is possible to set the ` echo ` to ` true ` using ` io:setopts/2 ` to enabling
103- echoing again.
99+ - ** mode** - ` cooked ` or ` raw ` . ` mode ` only has an effect if
100+ ` t:io:user/0 ` is a tty. If no ` mode ` is given, it defaults to
101+ ` cooked ` .
104102
105- When in ` cooked ` mode the OS will handle the line editing and all data is
106- passed to ` t:io:user/0 ` when a newline is entered.
103+ When in ` raw ` mode all key presses are passed to ` t:io:user/0 ` as
104+ they are typed when they are typed and the characters are not echoed
105+ to the terminal. It is possible to set the ` echo ` to ` true ` using
106+ ` io:setopts/2 ` to enabling echoing again.
107+
108+ When in ` cooked ` mode the OS will handle the line editing and all
109+ data is passed to ` t:io:user/0 ` when a newline is entered.
110+
111+ - ** signals** - Whether the terminal driver should handle signals and
112+ flow control. When ` false ` , control bytes such as ` ctrl+c ` , ` ctrl+o `
113+ and ` ctrl+s ` /` ctrl+q ` are passed to ` t:io:user/0 ` as data instead of
114+ being intercepted by the terminal driver. Defaults to ` true ` . Only
115+ has an effect in ` raw ` mode.
107116
108117- ** [ mfa()] ( `t:erlang:mfa/0` ) ** - Starts the interactive shell using
109118 [ ` mfa() ` ] ( `t:erlang:mfa/0` ) as the default shell. The ` t:mfa/0 ` should
@@ -136,7 +145,9 @@ On error this function will return:
136145 description of the error reasons.
137146""" .
138147-doc (#{since => <<" OTP 26.0" >>}).
139- -spec start_interactive (noshell | {noshell , raw | cooked } | {module (), atom (), [term ()]}) ->
148+ -spec start_interactive (noshell | {noshell , raw | cooked |
149+ #{mode => raw | cooked , signals => boolean ()}} |
150+ {module (), atom (), [term ()]}) ->
140151 ok | {error , already_started };
141152 ({remote , string ()}) ->
142153 ok | {error , already_started | noconnection };
@@ -148,6 +159,16 @@ start_interactive(noshell) ->
148159 start_interactive ({noshell , cooked });
149160start_interactive ({noshell , Type }) when Type =:= raw ; Type =:= cooked ->
150161 user_drv :start_shell (#{ initial_shell => noshell , input => Type });
162+ start_interactive ({noshell , #{mode := Mode } = Options }) when Mode =:= raw ; Mode =:= cooked ->
163+ case maps :get (signals , Options , true ) of
164+ Signals when is_boolean (Signals ) ->
165+ user_drv :start_shell (#{ initial_shell => noshell , input => Mode ,
166+ signals => Signals });
167+ _ ->
168+ erlang :error (function_clause , [{noshell , Options }])
169+ end ;
170+ start_interactive ({noshell , Arg }) ->
171+ erlang :error (function_clause , [{noshell , Arg }]);
151172start_interactive (InitialShell ) ->
152173 user_drv :start_shell (#{ initial_shell => InitialShell }).
153174
0 commit comments