aboutsummaryrefslogtreecommitdiff
path: root/doc_topics/03-terminal.md
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2025-04-10 10:04:19 +0200
committerGitHub <noreply@github.com>2025-04-10 10:04:19 +0200
commit98ca844bc6170ee332353abdeaac0be0e4a43af0 (patch)
tree88b0e2119a2c4b67c126349214a53b3ef8782c2b /doc_topics/03-terminal.md
parent49e7dac558178e6200bc5886db3ef28c73d5edd9 (diff)
downloadluasystem-98ca844bc6170ee332353abdeaac0be0e4a43af0.tar.gz
luasystem-98ca844bc6170ee332353abdeaac0be0e4a43af0.tar.bz2
luasystem-98ca844bc6170ee332353abdeaac0be0e4a43af0.zip
feat(term): detach fd of stderr+stdout to be independent (#59)
Diffstat (limited to '')
-rw-r--r--doc_topics/03-terminal.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/doc_topics/03-terminal.md b/doc_topics/03-terminal.md
index 5bdf543..a5341d6 100644
--- a/doc_topics/03-terminal.md
+++ b/doc_topics/03-terminal.md
@@ -16,6 +16,7 @@ Since there are a myriad of settings available;
16- `system.setconsoleflags` (Windows) 16- `system.setconsoleflags` (Windows)
17- `system.setconsolecp` (Windows) 17- `system.setconsolecp` (Windows)
18- `system.setconsoleoutputcp` (Windows) 18- `system.setconsoleoutputcp` (Windows)
19- `system.detachfds` (Posix)
19- `system.setnonblock` (Posix) 20- `system.setnonblock` (Posix)
20- `system.tcsetattr` (Posix) 21- `system.tcsetattr` (Posix)
21 22
@@ -105,6 +106,7 @@ To use non-blocking input here's how to set it up:
105 sys.setconsoleflags(io.stdin, sys.getconsoleflags(io.stdin) - sys.CIF_ECHO_INPUT - sys.CIF_LINE_INPUT) 106 sys.setconsoleflags(io.stdin, sys.getconsoleflags(io.stdin) - sys.CIF_ECHO_INPUT - sys.CIF_LINE_INPUT)
106 107
107 -- setup Posix by disabling echo, canonical mode, and making non-blocking 108 -- setup Posix by disabling echo, canonical mode, and making non-blocking
109 sys.detachfds() -- ensure stdin/out/err have their own file descriptions
108 local of_attr = sys.tcgetattr(io.stdin) 110 local of_attr = sys.tcgetattr(io.stdin)
109 sys.tcsetattr(io.stdin, sys.TCSANOW, { 111 sys.tcsetattr(io.stdin, sys.TCSANOW, {
110 lflag = of_attr.lflag - sys.L_ICANON - sys.L_ECHO, 112 lflag = of_attr.lflag - sys.L_ICANON - sys.L_ECHO,