Opening console/terminal handle with user input #21387

Open
opened 2026-01-31 07:43:14 +00:00 by claunia · 0 comments
Owner

Originally created by @ShrykeWindgrace on GitHub (Mar 12, 2024).

Hi!

I have a TUI app that reads some input from piped stdin and then shows something interactively to the user: tail -f log.txt | myTuiApp.

In order to do that on a linux machine, I'd grab stdin for reading those logs and openFile "/dev/tty" ReadMode to get user input (this is Haskell code, but you can surely get the idea).

In WT world I tried opening openFile "\\\\.\\CON" ReadMode, which opens a handle, but does not allow, e.g. setting console mode (and I need that to change buffering, enable VT processing, etc). I get a SetConsoleMode: permission denied (Access is denied.)

What is the canonical way to get a handle with user input if stdin is piped?

I have a Win10 with WT-1.19.10573.0

Originally created by @ShrykeWindgrace on GitHub (Mar 12, 2024). Hi! I have a TUI app that reads some input from piped stdin and then shows something interactively to the user: `tail -f log.txt | myTuiApp`. In order to do that on a linux machine, I'd grab `stdin` for reading those logs and `openFile "/dev/tty" ReadMode` to get user input (this is Haskell code, but you can surely get the idea). In WT world I tried opening `openFile "\\\\.\\CON" ReadMode`, which opens a handle, but does not allow, e.g. setting console mode (and I need that to change buffering, enable VT processing, etc). I get a `SetConsoleMode: permission denied (Access is denied.)` What is the canonical way to get a handle with user input if `stdin` is piped? I have a Win10 with `WT-1.19.10573.0`
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 07:43:14 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21387