Repository navigation
Implement lazy-read and noshell raw mode - #8962
Conversation
CT Test Results 6 files 303 suites 3h 10m 25s ⏱️ For more details on these failures, see this check. Results for commit 28953ce. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
|
You can read the new guides here: |
8e32c5a to
cd522a8
Compare
4f90535 to
085259c
Compare
c70d9fa to
f321f21
Compare
When running in `-noshell` mode, it is "normal" for programs to not eagerly read from stdin. This commit changes so that we only issue read requests to stdin when `user` has received a read request from the application. This change also makes it so that on Windows we don't have to abort an ongoing read request, which means that we can use ReadFile in non-overlapped mode and thus Unicode will work when reading from stdin in noshell mode on windows.
When an Erlang shell gets EOF it should halt the node, however very often stderr is also closed at the same time which caused the error printing to crash preventing halt to be called.
28953ce to
bd2ba03
Compare
broken links |
|
They can now be found in the official documentation I updated the links above as well |
|
As a heads up. The "Creating a terminal application" links to https://www.erlang.org/doc/apps/stdlib/assets/tic-tac-toe.es, which has a problem. The board characters served up the browser seem strangely encoded. But when I use curl/wget it is encoded correctly.
I'll be looking where to report this correctly, but for now I'll report it here in case anyone trips over it. |
|
Probably a character encoding issue on the server. I think the problem is that its serving this file as: Content-Type: application/ecmascript While it should be: Content-Type: text/html; charset=utf-8 |


This PR implements a couple of new fetures to how stdin and stdout is handled by Erlang.
All reads from stdin are now done upon request, instead of greedingly reading all data. So it is only when an
io:get_line/2or equivilant is issued by the Erlang program that a read is done. This solves io:get_line/1 cannot read cyrillic input on Windows with -noshell #8113 and also the problem mentioned by Josè here. This change also basically makes the-noinputflag obsolete, as no data will be read from stdin without it being requested.The
noshellmode has been updated to have two "submodes" calledraworcooked, wherecookedis the old default behaviour andrawcan be used to bypass the line editing support of the native terminal. Usingrawmode it is possible to read keystrokes as they happen without the user having to type Enter. Therawmode also does not echo the typed characters to stdout. An example of how to create a tic-tac-toe game using this mechanism is included in the documentation. This solves Getch for OTP26 #8037.There is also a new guide added that shows how to create a custom shell with autocomplete using Erlang's builtin line editor (basically what Elixir, Luerl and other do).