From 96fb7f1608e00d6f8ceb2a5d9a90483e92fe4e3a Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Fri, 4 Apr 2025 15:58:07 +0200 Subject: added changelog entry --- CHANGELOG.md | 7 +++++-- doc_topics/03-terminal.md | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fd09d1..c617db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ The scope of what is covered by the version number excludes: ### version 0.6.0, unreleased - Fix: when sleep returns an error, pass that on in `readkey`. +- Feat: added `detachfds` which will create separate file descriptions for `stdout` + and `stderr` to ensure that related settings (eg. non-blocking flag) will not be shared + amongst those streams and `stdin`. ### version 0.5.1, released 12-Mar-2025 @@ -42,12 +45,12 @@ The scope of what is covered by the version number excludes: - Feat: allow passing in a sleep function to `readkey` and `readansi` - Fix: NetBSD fix compilation, undeclared directives - Refactor: random bytes; remove deprecated API usage on Windows, move to - binary api instead of /dev/urandom file on linux and bsd + binary api instead of `/dev/urandom` file on linux and bsd ### version 0.4.5, released 18-Dec-2024 - Fix: suppress a warning when building with clang -- Fix: do not rely on luaconf.h to include limits.h, fixes builds with latest LuaJIT (#38). +- Fix: do not rely on `luaconf.h` to include `limits.h`, fixes builds with latest LuaJIT (#38). ### version 0.4.4, released 03-Sep-2024 diff --git a/doc_topics/03-terminal.md b/doc_topics/03-terminal.md index 3705cce..a5341d6 100644 --- a/doc_topics/03-terminal.md +++ b/doc_topics/03-terminal.md @@ -102,13 +102,11 @@ On Posix the traditional file approach is used, which: To use non-blocking input here's how to set it up: - -- Detach stdin/out/err; to get their own independent file descriptions - sys.detachfds() - -- setup Windows console to disable echo and line input (not required since _getwchar is used, just for consistency) sys.setconsoleflags(io.stdin, sys.getconsoleflags(io.stdin) - sys.CIF_ECHO_INPUT - sys.CIF_LINE_INPUT) -- setup Posix by disabling echo, canonical mode, and making non-blocking + sys.detachfds() -- ensure stdin/out/err have their own file descriptions local of_attr = sys.tcgetattr(io.stdin) sys.tcsetattr(io.stdin, sys.TCSANOW, { lflag = of_attr.lflag - sys.L_ICANON - sys.L_ECHO, -- cgit v1.2.3-55-g6feb